Why, oh, why doesn't a TToolButton automatically take the ImageIndex from a TAction??

Why, oh, why doesn't a TToolButton automatically take the ImageIndex from a TAction??

Without some hackary, you can't add a TToolButton to a TToolBar, so you can't create the TAction and TToolButton together to set the ImageIndex together... How frustrating!

Comments

  1. When adding a TAction to a TMenuItem, a number of properties of the TAction automatically get assigned to the TMenuItem in particular, ImageIndex. Why doesn't this happen for a TToolButton also? or why was it excluded?

    Why is it the only way to add a TToolButton to a TToolBar is to subclass TToolButton and call the protected method "SetToolBar()"?

    Both issues are annoying!

    ReplyDelete
  2. I cannot reproduce the first issue. When I create a TToolButton and assign its Action property the ImageIndex is taken from the Action.
    For the second issue I usually use a class helper and introduce a property ToolBar that returns the protected FToolBar in its Getter and calls inherited SetTooBar in its Setter.

    ReplyDelete
  3. Ok. I might have to eat humble pie and call the first issue a bit of a pebcak :-O - It could be that I didn't do everything in the right order :-\

    Thanks for making me seeing the error of my way Uwe Raabe - Life with errors is boring.

    Still, the second issue has been around forever :-(

    ReplyDelete

Post a Comment