Announcement

Collapse
No announcement yet.

ButtonPlus in Source Code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ButtonPlus in Source Code

    I've uploaded my enhanced pushbutton code to the source code forum. This code is already in use in my major application so should be relatively stable (famous last words). Any suggestions for improvement or extension gratefully received!
    - LJ

  • #2
    Thanks, this is a very nice addition. I can see that it will be very helpful in future projects!
    Scott Slater
    Summit Computer Networks, Inc.
    www.summitcn.com

    Comment


    • #3
      Thanks for your comments Scott, both here and in the Source Code forum. Thanks for looking so closely. That's partly the reason for posting - to get another pair of eyes on it, spotting things that I've missed.

      Of course you're right on both counts and I've updated the posted code and files to include these changes.

      Immediately I posted originally I saw another thing also. In the focus tracking code there was a lot of duplicated code in the dialog activation and de-activation sections which has now been consolidated. It was my intention to re-use vacant array slots for dialogs which had been destroyed, but I neglected to mark the array elements as unused. This may be significant for memory use if used in an application which creates and destroys a lot of dialogs. The update also includes these changes.
      - LJ

      Comment


      • #4
        Originally posted by Laurence Jackson View Post
        Any suggestions for improvement or extension gratefully received!
        Sure, a link to the code.

        The screenshots look fabulous.

        ======================================
        “Lord, grant that my work
        increase knowledge and help other men.

        “Failing that, Lord, grant that
        it will not lead to man’s destruction.

        “Failing that, Lord, grant that
        my article be published
        before the destruction takes place.”
        Scientist's Prayer
        ======================================
        Last edited by Gösta H. Lovgren-2; 24 Oct 2008, 10:50 PM.
        It's a pretty day. I hope you enjoy it.

        Gösta

        JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
        LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

        Comment


        • #5
          Originally posted by Gösta H. Lovgren-2 View Post
          Sure, a link to the code.
          I'm not sure what you mean, all the source code, resources, compiled executables and documentation are in the attached zip.
          - LJ

          Comment


          • #6
            What he meant was that to help us go directly to your post in the source code, post a link to that topic here, like this:

            http://www.powerbasic.com/support/pb...ad.php?t=38903

            This is because the source code forum keeps growing, so rather than have interested PB's have to look through many pages of the forum or do an on-line search ... please add the link in the discussing thread when you start it. Most will appreciate that!
            Rick Angell

            Comment


            • #7
              Originally posted by Laurence Jackson View Post
              I'm not sure what you mean, all the source code, resources, compiled executables and documentation are in the attached zip.
              Laurence, for whatever reason I just now got around to playing/looking at your Buttons. And they look neat. (I've long wanted to have colored buttons.) The .exe's run fine, however when I try to run ButtonPlusDemo.bas, there's a Msgbox "Go To Line" and then a compiler error "No resource file".

              I tried compiling "ButtonPlusDemo.RC" to get a .pbr but get"Error occurred creating Resource (RES) file." Here's the code
              Code:
              #include "Resource.h"
              VS_VERSION_INFO VERSIONINFO
              FILEVERSION 1, 0, 0, 0
              PRODUCTVERSION 1, 0, 0, 0
              FILEOS VOS_WINDOWS32
              FILETYPE VFT_APP
              BEGIN
                BLOCK "StringFileInfo"
                BEGIN
                  BLOCK "040904B0"
                  BEGIN
                    VALUE "CompanyName",      "Laurence Jackson\000"
                    VALUE "FileDescription",  "ButtonPlus Demo\000"
                    VALUE "FileVersion",      "01.00.0000\000"
                    VALUE "InternalName",     "BUTTONPLUS\000"
                    VALUE "OriginalFilename", "BUTTONPLUS.EXE\000"
                    VALUE "LegalCopyright",   "Public domain\000"
                    VALUE "ProductName",      "\000"
                    VALUE "ProductVersion",   "\000"
                    VALUE "Comments",         "\000"
                  END
                END
                BLOCK "VarFileInfo"
                BEGIN
                  VALUE "Translation", 0x409, 0x4B0
                END
              END
              #define IDR_HICON 200
              IDR_HICON ICON DISCARDABLE "HI.ICO"
              #define CREATEPROCESS_MANIFEST_RESOURCE_ID   1
              #define RT_MANIFEST                         24
              CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "xptheme.xml"
              =================================================
              She knows what is the best purpose of education:
              not to be frightened by the best
              but to treat it as part of daily life.
              John Mason Brown
              =================================================
              It's a pretty day. I hope you enjoy it.

              Gösta

              JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
              LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

              Comment


              • #8
                Check the ".rclog" file created by RC.EXE.

                I've had problems getting error messages from RC.EXE back from the PB IDE resource compile. This file has the error message (if any) from RC.EXE.

                (Seems with IDE compile, PBRES just runs anyway even when rc.exe returns an error. Kind of strange.. about the only good thing is it makes you pay attention during the resource compile.)

                MCM
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  Originally posted by Michael Mattias View Post
                  Check the ".rclog" file created by RC.EXE.

                  MCM
                  No .rclog's created anywhere I can find. Several in the PB9 folders but none related ButtonPlus. Not in the resident folder either.

                  =====================================================
                  "#3 pencils and quadrille pads."
                  Seymoure Cray (1925-1996)
                  when asked what CAD tools
                  he used to design the Cray I supercomputer;
                  he also recommended using the back side of the pages
                  so that the grid lines were not so dominant.
                  =====================================================
                  It's a pretty day. I hope you enjoy it.

                  Gösta

                  JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                  LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                  Comment


                  • #10
                    Then just try a straight command-line resource compile and see what you can on the screen.

                    Code:
                    C:\DOS> rc.exe  sourcefilename[.rc]
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      At first I thought that it might be to do with me using a newer resource compiler than that supplied with PB9, but I've just tried it with the old RC and it still works fine for me, so I'm stumped. Are both "hi.ico" and "xptheme.xml" in the directory with "ButtonPlusDemo.rc"?
                      - LJ

                      Comment


                      • #12
                        Originally posted by Michael Mattias View Post
                        Then just try a straight command-line resource compile and see what you can on the screen.

                        Code:
                        C:\DOS> rc.exe  sourcefilename[.rc]
                        Nothing happened either. Think I'll just wait for Laurence to post a valid pbr. Thanks anyway.

                        ===========================================
                        "We don't need lists of rights and wrongs,
                        tables of do's and don'ts:
                        we need books, time, and silence.
                        'Thou shalt not'
                        is soon forgotten,
                        but 'Once upon a time'
                        lasts forever."
                        Philip Pullman (1946-)
                        ===========================================
                        It's a pretty day. I hope you enjoy it.

                        Gösta

                        JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                        LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                        Comment


                        • #13
                          OK Gösta, here's a PBR hot from the compiler that works for me
                          Attached Files
                          - LJ

                          Comment


                          • #14
                            At first I thought that it might be to do with me using a newer resource compiler than that supplied with PB9, but I've just tried it with the old RC and it still works fine for me, so I'm stumped. Are both "hi.ico" and "xptheme.xml" in the directory with "ButtonPlusDemo.rc"?
                            Both files are in the same folder. When looking I saw that 4 or 5 new files created today at about the same time as I was trying to compile the bpd.rc. They are named "RCa01512" through "RCa03824" (no extensions) which presumably are files created when I tried to compile your .rc.

                            It's clear I'm doing something wrong here. I expected that when I compiled "BPD.rc" it would create "BPD.pbr". Obviously I'm wrong.

                            Originally posted by Laurence Jackson View Post
                            OK Gösta, here's a PBR hot from the compiler that works for me
                            Thanks, L. That did the trick. Just so you know, there were no .pbr's in the zip file.

                            =================================
                            "Too many pieces of music finish
                            too long after the end."
                            Igor Stravinsky (1882-1971)
                            =================================
                            It's a pretty day. I hope you enjoy it.

                            Gösta

                            JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                            LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                            Comment


                            • #15
                              Laurence,

                              Nice work. Thanks !

                              Kind regards
                              Eddy

                              Comment


                              • #16
                                Gösta: There wasn't intended to be a PBR in the ZIP. You should have been able to make it from the RC and other files. I still don't understand why you couldn't. Anyone else have problems?

                                Eddy: We all need kind words now and then - thanks!
                                - LJ

                                Comment


                                • #17
                                  Originally posted by Laurence Jackson View Post
                                  Gösta: There wasn't intended to be a PBR in the ZIP. You should have been able to make it from the RC and other files. I still don't understand why you couldn't. Anyone else have problems?
                                  For the record (as I haven't made much use of .rc files on my own), here's exacttly what I did (just now again). Loaded "ButtonPlusDemo.rc" into JellyFishPro. and compiled it. (Tried both Compile and Compile & Execite)
                                  Each time it created a 2k file beginning with "RC" and 3 hex vals and no extension.

                                  I've checked the settings file in JFP and they are set correctly... so I tried PB8, ... same thing.

                                  While writing this I got to thinking maybe it wasn't finding the "Resource.h" include. And sure enough, Resource.h is stored in the \WinApi\ and the compiler was looking in \bin\, so my setting was incorrect after all.

                                  Everything hunky dory now.
                                  Eddy: We all need kind words now and then - thanks!
                                  Yes we do. And here's mine to you, L - Thanks for a nice job.

                                  =============================================
                                  "I contend that we are both atheists.
                                  I just believe in one fewer god than you do.
                                  When you understand why
                                  you dismiss all the other possible gods,
                                  you will understand why I dismiss yours."
                                  Sir Stephen Henry Roberts (1901-1971)
                                  =============================================
                                  It's a pretty day. I hope you enjoy it.

                                  Gösta

                                  JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                                  LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                                  Comment


                                  • #18
                                    While writing this I got to thinking maybe it wasn't finding the "Resource.h" include. And sure enough, Resource.h is stored in the \WinApi\ and the compiler was looking in \bin\, so my setting was incorrect after all.
                                    I'm glad you found the problem. That said, either that ".rclog" file or one of the "Ra12324" files should have error messages from the failed resource compile.

                                    Just one word of warning: those error messages are cryptic at best. (Frankly they stink). However, when you get "undefined symbol" it can mean missing #include or you did not match the CASE of the token between the #define and its use.

                                    You can also get "newline unexpected." This usually means either a mismatch in BEGIN/END statments OR.... mismatched quotes (this one gets me all the time).

                                    Mismatched quotes can give you all kinds of strange errors so that's always a good thing to look for when the error message itself is less than helpful.

                                    MCM
                                    Michael Mattias
                                    Tal Systems (retired)
                                    Port Washington WI USA
                                    [email protected]
                                    http://www.talsystems.com

                                    Comment


                                    • #19
                                      Originally posted by Michael Mattias View Post
                                      I'm glad you found the problem. That said, either that ".rclog" file or one of the "Ra12324" files should have error messages from the failed resource compile.
                                      Never found an "rclog". I just searched again. The "RC1234f5" file were in machine code and unreadable in a text editor.

                                      Back to subject at hand (Laurence's neat (and hopefully ging to be useful to me) code. In in effort to get a better grasp of the demo code I just spent some time changing variable names and moving the buttons into Macros. Looks like it is going to be a worthwhile time investment for me as I think now I'm seeing better how it works. It's attached for any who are interested.

                                      ==============================
                                      "Everybody pities the weak;
                                      jealousy you have to earn."
                                      Arnold Schwarzenegger (1947-)
                                      ==============================
                                      Attached Files
                                      It's a pretty day. I hope you enjoy it.

                                      Gösta

                                      JWAM: (Quit Smoking): http://www.SwedesDock.com/smoking
                                      LDN - A Miracle Drug: http://www.SwedesDock.com/LDN/

                                      Comment


                                      • #20
                                        May be useful, may be not so useful....
                                        Code:
                                        D:\Software_Development\pbwin90\bin>rc.exe /?
                                        
                                        Microsoft (R) Windows 32 Resource Compiler, Version 4.00 - Build 1367
                                        
                                        Usage:  rc [options] .RC input file
                                        Switches:
                                           /r    Emit .RES file (optional)
                                           /v    Verbose (print progress messages)
                                           /d    Define a symbol
                                           /u    Undefine a symbol
                                           /fo   Rename .RES file
                                           /l    Default language ID in hex
                                           /i    Add a path for INCLUDE searches
                                           /x    Ignore INCLUDE environment variable
                                           /c    Define a code page used by NLS conversion
                                        Flags may be either upper or lower case
                                        
                                        D:\Software_Development\pbwin90\bin>
                                        MCM
                                        Michael Mattias
                                        Tal Systems (retired)
                                        Port Washington WI USA
                                        [email protected]
                                        http://www.talsystems.com

                                        Comment

                                        Working...
                                        X