Changing Delphi SpeedButton Glyph

While developing I wanted to change the glyph on a TSpeedButton to another image. My first attempt was to has 2 different actions in an actionlist, then at run time I would change the action on the button depending on what was required. This did not work, the only solution I have found, which is not very elegant is to put 2 non visible buttons on the form each with a different glyph, then in code when I want to chanage the image I do the following:

VisibleBtn.Glyph.Assign(Image1Btn.Glyph);

This does the trick but it would have been nice if when changing the action of a button it does not just change the caption but also the related image.

Leave a Reply

You must be logged in to post a comment.