5

I am dyanamically creating speedbuttons in tab change procedure, i want to made speed button disabled , when it is disabled it is not showing the loaded image. how to show the image on speed button when it is in disable state. I am using the code SpeedButton,SpeedButton.Glyph.LoadFromFile(Path) AND USING SpeedButton.numGlyphs =1

TLama
  • 75,147
  • 17
  • 214
  • 392
Sym
  • 51
  • 1
  • 2
  • 4

1 Answers1

3

The image used in the Glyph can contain upto 4 images, one for each state of the SpeedButton (up, down, disabled, selected).

The images are placed adjacent to each other in a single bitmap file that is used for the Glyph property of the SpeedButton. Use NumGlyphs to indicate how many images are used in the Glyph (eg. you can use only 2 or only 3 images).

Read the documentation on SpeedButton Glyph property.

  • 11
    The order is actually `Up`, `Disabled`, `Clicked`, `Down`. Having one image means it's used for all states, two are used for `Up` and `Disabled`, and so forth. The link to the most recent docs (which still applies to D7, as `TSpeedButton` hasn't changed much) is [here](http://docwiki.embarcadero.com/Libraries/en/Vcl.Buttons.TSpeedButton.Glyph). If only one image is provided, the VCL creates a masked version of it to use for the disabled state, which is often hidden (invisible) or only partially drawn. – Ken White Jul 30 '12 at 22:22
  • This does not do the trick when the glyph comes from an action. I even have `DisabledImages` assigned on the action manager (which I have pointed to the same as the regular images), thus the `Glyph` gets automagically assigned. However, it does *not* accommodate for disabled images. Setting `GlyphCount` to 1 does nothing either. – Jerry Dodge May 24 '17 at 21:36