Announcement

Collapse
No announcement yet.

Ownerdraw toolbar imagelist index?

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

  • Michael Mattias
    replied
    Update re paying taxes being a Fun Thing: It wasn't.

    Leave a comment:


  • Edwin Knoppert
    replied
    Hmm.. tax..
    I usually get back

    and.. i can't wait..

    Last edited by Edwin Knoppert; 17 Jan 2009, 10:38 AM.

    Leave a comment:


  • Michael Mattias
    replied
    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.

    Leave a comment:


  • Edwin Knoppert
    replied
    >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.

    Leave a comment:


  • Michael Mattias
    replied
    ...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).

    Leave a comment:


  • Edwin Knoppert
    replied
    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,

    Leave a comment:


  • Dominic Mitchell
    replied
    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.

    Leave a comment:


  • Michael Mattias
    replied
    >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.

    Leave a comment:


  • Edwin Knoppert
    replied
    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)

    Leave a comment:


  • Michael Mattias
    replied
    Code:
    SetWindowLong, hButton, %GWL_USERDATA, image_index
    ...
         hIL                 = SendMessage (hTB, TB_GETIMAGELIST....
         imageidx          = GetWindowLong (hButton, %GWL_USERDATA) 
         ImageList_Draw   hIL, imageidx.....
    ???

    Leave a comment:


  • Edwin Knoppert
    started a topic Ownerdraw toolbar imagelist index?

    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.
Working...
X