Announcement

Collapse
No announcement yet.

CONTROL SET/GET USER statements

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

  • CONTROL SET/GET USER statements

    In my programs, if ownerdrawn controls are present, I use extensively the sentences CONTROL SET/GET USER due that allows some kind of communication between normal program and ownerdraw routines during normal execution.

    PB documentation says:
    Code:
    CONTROL SET USER ...    or    CONTROL GET USER ...
    . . .
    [I]index&[/I] is the index number of the user data value to set/retrieve, 
    in the range 1 to 8 inclusive.
    Due to type errors in my last program I used 11 to 18 instead of 1 to 8 and the program is compiled without errors and works as expected. I realized some tests and seems that this sentences accepts up to 23 user data areas per control.

    My question is this behavior not documented is a problem or maybe is an expansion for future versions and I can use more that 8 possible user data areas ? Would be fantastic for me because I need up to 10 user areas in one of my current projects.

    Jordi

  • #2
    Jordi --

    Please do not use more than 8 32-bit data items. If you use more, you are overwriting other data which will eventually cause serious, but unpredictable results.

    Bob Zale
    PowerBASIC Inc.

    Comment


    • #3
      Ok Bob. Is what I supposed. But it's nice to imagine more of eight user areas.
      Thanks

      Comment


      • #4
        >But it's nice to imagine more of eight user areas.

        Code:
        TYPE UserAreaType
           UserArea (1 TO  many many many) AS LONG 
        END TYPE
        
          LOCAL pUA AS UserAreaType PTR,  hMem AS LONG 
          GLOBALMEM ALLOC SIZEOF(@pUA) TO hMem
          GLOBALMEM LOCK hMem to pUA 
          FOR Z = 1 To Many many many 
              @pUA.UserArea(Z) = my value 
          NEXT
          GLOBALMEM UNLOCK  hMem
          CONTROL SET USER   CBHNDL,%ID_CONTROL, 1, hMem
        ....

        (I had submitted a NFS for ONE (1) such setting. I got eight. I was happy).

        MCM
        Last edited by Michael Mattias; 3 Nov 2009, 02:42 PM.
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Sounds a good alternative, and probably faster. Thanks Michael.

          A question, what NFS means ? The FreeDictionary on Google has 43 different acronyms for this, from Network File System to Not for Sale, or perhaps means
          Not Fully Specified ? I'm not very fond of acronyms.

          Jordi

          Comment


          • #6
            Sorry about using an acronym; NFS in this context means "New Feature Suggestion."

            You send those to the PBPTB.

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

            Comment


            • #7
              Originally posted by Bob Zale View Post
              Jordi --

              Please do not use more than 8 32-bit data items. If you use more, you are overwriting other data which will eventually cause serious, but unpredictable results.

              Bob Zale
              PowerBASIC Inc.
              I am puzzled why, if PB only wants you to use a maximum of eight 32-bit data items, it would allow you to use more. I've never written a compiler before but I would hope it could trap any number over 8 that is sent to a CONTROL/DIALOG GET/SET USER command.

              Comment


              • #8
                PowerBASIC Philosophy on Run-Time exceptions...

                http://www.powerbasic.com/support/help/pbwin/index.htm

                Comment


                • #9
                  Where on that page would I find "PowerBASIC Philosophy on Run-Time exceptions..." ?

                  Comment


                  • #10
                    In summary the philosophy is implemented as , "If we set the system ERR variable in response to an invalid parameter being passed to an intrinsic function, it's news to us, too. For the most part, such actions will get you undefined results with equally undefineable consequences... either some of the time or most of the time."

                    In case you had not guessed, I would happily sacrifice a little runtime speed in exchange for better error handling in these cases.

                    But I was not in the room when that decision was made.
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      Hi Bob, thanks for checking in and posting.

                      However, your post was a little cryptic, and perhaps also a bit sarcastic

                      It contained a link to PB9. Was your intent to indicate that PB9 traps this condition whereas PB8 did not?

                      Comment


                      • #12
                        In case you had not guessed, I would happily sacrifice a little runtime speed in exchange for better error handling in these cases.
                        A little speed here, a little speed there, .... Pretty soon we'll have #Mommy On all the time.

                        =================================================
                        "A newspaper is a collection of half-injustices"
                        =================================================
                        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
                          Since we're talking errors, I assume Mr. Zale is refering to the following:

                          Error Overview
                          Unlike the DOS versions of PowerBASIC, Windows versions of PowerBASIC employ a completely different philosophy: to generate the smallest and fastest possible code. Consequently, error handling is placed firmly in the hands of the programmer. PowerBASIC does not stop your program when a run-time error occurs. It is responsibility of the programmer to check for any conceivable errors that may occur after executing a statement...
                          See "Error and Error Trapping/Error Overview" on the link provided for more details.
                          Regards,
                          Marc

                          Comment


                          • #14
                            little speed here, a little speed there, .... Pretty soon we'll have #Mommy On all the time.
                            The solution to that is pretty obvious... after debugging, you just set #MOMMY OFF and recompile!
                            Michael Mattias
                            Tal Systems (retired)
                            Port Washington WI USA
                            [email protected]
                            http://www.talsystems.com

                            Comment


                            • #15
                              Originally posted by Marc Giao View Post
                              See "Error and Error Trapping/Error Overview" on the link provided for more details.
                              I don't see that on the link provided - all I see are the following links,
                              %-W buttons and:
                              Introducing PowerBASIC For Windows
                              New Statements and Functions
                              Command Summary
                              Running PB/Win
                              Data Types
                              Built-in numeric equates
                              Built-in string equates
                              Glossary
                              Register
                              Technical Support
                              Downloads
                              Peer Support Forums

                              Comment


                              • #16
                                Hi Stuart,

                                Wrong list

                                Look to the left, the "Contents" tab, twelfth item down.
                                Regards,
                                Marc

                                Comment


                                • #17
                                  Originally posted by Marc Giao View Post
                                  Look to the left, the "Contents" tab, twelfth item down.
                                  You mean the "Flash inside another Flash" left hand panel that my Firefox "FlashBlock" add-on just shows as a blank - not even an icon to show that there would be more content there if I activated the top Flash menu?

                                  Grrrrr!

                                  Comment


                                  • #18
                                    Should look as follows:
                                    Attached Files
                                    Regards,
                                    Marc

                                    Comment

                                    Working...
                                    X