Announcement

Collapse
No announcement yet.

Ownerdraw toolbar imagelist index?

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

  • Ownerdraw toolbar imagelist index?

    During the oncustomdraw message the NMTBCUSTOMDRAW structure does not seem to pass the imagelist's index.

    I am currently using the TB_COMMANDTOINDEX message to convert the buttin ID to an ordinal index and then obtain the image index via a getbutton message.

    Technically it is possible to add buttons having the same ID.
    The image index is not passed, it's rect is though, not really a solid thing to obtain an index from.
    hellobasic

  • #2
    Code:
    SetWindowLong, hButton, %GWL_USERDATA, image_index
    ...
         hIL                 = SendMessage (hTB, TB_GETIMAGELIST....
         imageidx          = GetWindowLong (hButton, %GWL_USERDATA) 
         ImageList_Draw   hIL, imageidx.....
    ???
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      The zero-based icon index i mean.
      Each button is set using a TBBUTTON structure having a button ID and image index.
      The image index for the button to draw does not seem to be present.

      (And thus not the imagelist handle)
      hellobasic

      Comment


      • #4
        >The image index for the button to draw does not seem to be present...
        ...and thus why I suggested saving said index yourself with the button
        >And thus not the imagelist handle...
        ...and thus why I suggested asking the toolbar for said handle when needed.

        Best guess? Windows decided when designing the owner-draw notifications that when used the programmer would have command of the data needed to perform said drawing and thus no need to provide image list info in said notifications.
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          Code:
          SetWindowLong, hButton, %GWL_USERDATA, image_index
          ...
               hIL                 = SendMessage (hTB, TB_GETIMAGELIST....
               imageidx          = GetWindowLong (hButton, %GWL_USERDATA) 
               ImageList_Draw   hIL, imageidx.....
          Sorry Michael but that will never work.
          I have said more than once on these forums that toolbar buttons are not
          windows. They are simply parts of the client area of the toolbar that are
          rendered to look like buttons. Therefore, there is no such thing as a toolbar
          button handle.

          Edwin, if you are so worried about duplicate toolbar button identifiers, then
          store the image index in the application-defined data member for each button.
          It can be set using the following structures:
          TBBUTON -> dwData member
          TBBUTTONINFO -> lParam member

          During the NM_CUSTOMDRAW notification, the application-defined value is accessed
          via the lItemlParam member.
          Last edited by Dominic Mitchell; 16 Jan 2009, 05:29 PM.
          Dominic Mitchell
          Phoenix Visual Designer
          http://www.phnxthunder.com

          Comment


          • #6
            I know but i am trying to write a new control and keep the essentials.
            It is odd..
            But then, it's a rare situation to have duplicate id's.
            We'll see, it ain't that important at this time.

            Thanks,
            hellobasic

            Comment


            • #7
              ...have said more than once on these forums ...
              toolbar buttons are not windows. ...
              TBBUTON -> dwData member...
              TBBUTTONINFO -> lParam member
              As I have said more than once on these forums, I do big ideas; details are left to staff.

              Had I started down my own road literally I am confident I would have seen the error of my ways, repented, and then found the same TBBUTTON/TBBUTTONINFO solution. (I am a big fan of "dwuser" and "lparam" integers).
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                >As I have said more than once on these forums, I do big ideas; details are left to staff.
                Then there is no urge to response right?
                We are talking details here.

                >I am a big fan of "dwuser" and "lparam" integers
                Those user parameters undermine modular programming.
                Just like:
                1) Using the caption for style settings during creation.
                2) Enhancing a class's extra bytes for superclassed controls.

                And..like i mentioned before, even before i post i know at least one work around.
                Several of my latest posts i made are simply to confirm if i am overlooking something.
                hellobasic

                Comment


                • #9
                  So much for me being able to "lighten up" this discussion.

                  Sheesh, going to pay my taxes this AM is starting to sound like a Fun Thing.
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment


                  • #11
                    Update re paying taxes being a Fun Thing: It wasn't.
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment

                    Working...
                    X