[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Buttons' (#lcl)

# TButtonGlyph

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Represents an image that can be attached to a button.

## Declaration

Source position: buttons.pp line 75

`type TButtonGlyph = class(TObject, IUnknown, IImageCacheListener)`
`public`
`function QueryInterface();` |  | Implements the method from IUnknown.
`function _AddRef;` |  | Implements the method from IUnknown.
`function _Release;` |  | Implements the method from IUnknown.
`procedure CacheSetImageList();` |  | Stores the specified Image list in the Images property.
`procedure CacheSetImageIndex();` |  | Sets the button state for the image in AIndex to the value specified in AImageIndex.
`protected`
`function CanShow;` |  | Indicates if the glyph image can be drawn for the button glyph.
`function CanShowGlyph;` |  | Determines if an image is available for the button glyph.
`procedure DoChange; virtual;` |  | Performs actions needed when the glyph image has been changed for the class instance.
`procedure GlyphChanged();` |  | Provides a default implementation for the OnChange event handler.
`procedure SetTransparentMode();` |  | Sets the value for the TransparentMode property.
`property TransparentMode: TGlyphTransparencyMode; [r]` |  | Indicates the transparency mode used to render the glyph image.
`public`
`constructor Create;` |  | Create - constructor for TButtonGlyph: frees the Images cache then creates a Glyph Bitmap.
`destructor Destroy; override;` |  | Destroy - destructor for TButtonGlyph: frees caches and calls inherited Destroy.
`procedure GetImageIndexAndEffect();` |  | Gets the index for a button image using a given state, and the effect used to draw it.
`function Draw();` |  | Draws the glyph for the button using the specified settings and state.
`procedure Refresh;` |  | Updates the button glyph after changes to property values.
`property Glyph: TBitmap; [rw]` |  | The bitmap image drawn as the glyph on the button.
`property IsDesigning: Boolean; [rw]` |  | Indicates whether change notifications are suppressed while editing property values.
`property NumGlyphs: TNumGlyphs; [rw]` |  | The number of glyphs available for button states.
`property Images: TCustomImageList; [r]` |  | The list of available images for the button glyph.
`property LCLGlyphName: string; [rw]` |  | Stores the standard LCL resource name used for the Glyph in the class instance.
`property ExternalImages: TCustomImageList; [rw]` |  | Contains a reference to an external list of images that can be used as the Glyph image,
`property ExternalImageWidth: Integer; [rw]` |  | Width for the images in the ExternalImages property.
`property ExternalImageIndex: Integer; [rw]` |  | Ordinal position for the bitmap in ExternalImages displayed when the button is Up (not pressed).
`property ExternalHotImageIndex: Integer; [rw]` |  | Ordinal position in ExternalImages for the image displayed when the button is Hot (hovered).
`property ExternalDisabledImageIndex: Integer; [rw]` |  | Ordinal position in ExternalImages for the image displayed when the button is Disabled.
`property ExternalPressedImageIndex: Integer; [rw]` |  | Ordinal position in ExternalImages for the image displayed when the button is Pressed (down).
`property ExternalSelectedImageIndex: Integer; [rw]` |  | Ordinal position in ExternalImages for the image displayed when the button is Selected (has focus).
`property Width: Integer; [r]` |  | The Width of the Glyph image.
`property Height: Integer; [r]` |  | The height of the glyph image.
`property ShowMode: TGlyphShowMode; [rw]` |  | Indicates the logic used to display the Glyph image for the class instance.
`property OnChange: TNotifyEvent; [rw]` |  | Event handler signalled when the bitmap in Glyph has been changed.
`end;`

## Inheritance

`TButtonGlyph,IUnknown,IImageCacheListener` |  | Represents an image that can be attached to a button.
`TObject`

## Description

TButtonGlyph is a TObject descendant used to represent the image with the symbol or pictograph displayed on a button, or in a column in a grid. Use the properties and methods in the class to specify the image displayed in the glyph, and the display settings required for the image.

Images and ExternalImages are image lists with the content that can be displayed in the glyph. Glyph contains the bitmap, scaled to the necessary display density, used in the class instance. Width and Height represent the dimensions for the Glyph.

ShowMode determines when the image is displayed, just like its usage in TMenu and TMenuItem.

TransparentMode indicates whether the glyph image is drawn with transparency, as works in conjunction with the Transparent property in the parent control.

TButtonGlyph implements the IImageCacheListener interface used to provide support for cached images in TImageList. TButtonGlyph also implements the IUnknown interface to support the QueryInterface method and reference counting.

TButtonGlyph is the type used to implement the ButtonGlyph property in TCustomBitBtn and TCustomSpeedButton.

## See also

TCustomSpeedButton.ButtonGlyph |  | Gets the TButtonGlyph used for the control.
TMenu |  | TMenu - a menu appearing in a form. Base class for TMainMenu or TPopupMenu.
TMenuItem |  | Represents a menu item displayed in a menu.