Search code examples
delphibuttonglyph

Delphi: Show/Hide Glyph from a TBitbtn


I would like to hide or show the glyph from a bitbtn after the same button is pressed.

Example: I have on a form with a 'Back' button and a 'Next' button. Both have a glyph with arrows. After the 'Next' button is pressed it's transforming in 'Finish' button without a glyph. Similar if the 'Back' button is pressed, the 'Finish' button is becoming 'Next' button with the arrow glyph. Finish button have no icon.


Solution

  • Glyph is of type TBitmap. In order to hide the glyph, assign Nil to it:

    MyButton.Glyph := Nil;
    

    In order to show a glyph, you need a TBitmap object with the image and assign it to Glyph:

    MyButton.Glyph := MyBitmap;