Contains types and classes used to implement specialized buttons.

buttons.pp contains classes, types, and routines used to implements specialized button controls. It registers the following components in the Lazarus IDE component palette:

Additional Tab

  • TBitBtn
  • TSpeedButton

buttons.pp is part of the Lazarus Component Library (LCL).

Enumerated type which defines the position for a glyph on a button.

TButtonLayout is an enumerated type which contains constants that define the position for a glyph on a button. It is used to implement the Layout property in TBitBtn and TSpeedButton classes. It is also used to control the layout of images drawn in the columns for TGrid and TStringGrid.

TCustomGrid TCustomStringGrid TGridColumn TGridColumnTitle.ImageLayout
Image is drawn aligned to the left. Image is drawn aligned to the right. Image is drawn aligned to the top. Image is drawn aligned to the bottom. A set of constants to define the state of a SpeedButton.

TButtonState is an enumerated type with constants that define the drawing state for a button. TButtonState is the type used to implement the internal State member in TCustomSpeedButton. It is also used to access bitmap images in TButtonGlyph drawn for the corresponding state using its Draw method.

Draw the button in its up state. Draw the button in its disabled state. Draw the button in its down state. Draw the button as the only one down in its group. Draw the button when the mouse cursor is hovered over the control. Represents button identifiers defined in the lcltype.pp unit.

TButtonImage is a range type used to represent the button identifier constants defined in the lcltype.pp unit, like: idButtonOk, idButtonCancel, idButtonHelp, idButtonYes, idButtonNo, et. al. TButtonImage is the type passed as an argument to routines like: GetButtonImageIndex, BitBtnResNames, and LoadGlyphFromResource. It is also passed as an argument to the TCustomBitBtn.LoadGlyphFromResource method.

Defines the range of values available to access button glyphs.

TNumGlyphs is an Integer range constant which defines the minimum and maximum number of glyphs available for buttons. TNumGlyphs is the type used to implement the NumGlyphs property in TButtonGlyph, TCustomBitBtn, and TCustomSpeedButton.

Enumerated type with transparency mode values for button glyphs.

TGlyphTransparencyMode is an enumerated type which contains values representing the transparency modes used for button glyphs. TGlyphTransparencyMode is the type used to implement the TransparentMode property in TButtonGlyph.

Transparency is defined in the glyph. Transparent is not used, as defined by the owner of the glyph. Glyph is drawn with transparency. Represents an image that can be attached to a button.

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.

TMenu TMenuItem
Gets the value for the ExternalImageIndex property. Value for the ExternalImageIndex property. Ordinal position in the array of image indexes accessed for the property value. Gets the value for the Height property. Value for the property. Gets the value for the NumGlyphs property. Value for the property. Gets the value for the Width property. Value for the property. Initializes values in the internal array of image indexes used in property values.

Sets all byte values in the storage for an internal array of image indexes to the value $FF. Called from the Create constructor, and when a new bitmap is assigned to the Glyph property.

Added in LCL version 2.3.0. Available since version 3.0.
Sets the value for the ExternalImageIndex property. Ordinal position in the array of image indexes updated with the new value for the property. New value for the ExternalImageIndex property. Sets the value for the ExternalImages property. New value for the property. Sets the value for the ExternalImageWidth property. New value for the property. Sets the value for the Glyph property. New value for the property. Sets the value for the NumGlyphs property. New value for the property. Sets the value for the ShowMode property. New value for the property. Removes the references to Images for the button states.

ClearImages is a procedure used to remove index references to Images used for button states in the glyph. ClearImages sets the values in an internal member to -1 to indicate that the image for the corresponding TButtonState is not used.

Removes the name for the LCL Glyph resource used in the class instance. Sets the value for the LCLGlyphName property. New value for the LCLGlyphName property. Implements the method from IUnknown. Interface identifier for the specified object. Object examined for the specified interface. Implements the method from IUnknown. Always contains -1. Implements the method from IUnknown. Always contains -1. Stores the specified Image list in the Images property.

Implements the IImageCacheListener interface method used to receive changes to the cached image list. Stores the image list specified in AImageList to the Images property.

Image list stored to the Images property. Sets the button state for the image in AIndex to the value specified in AImageIndex. Position of the Button state applied to the specified image. Position of the Image updated in the method. Indicates if the glyph image can be drawn for the button glyph.

CanShow is a Boolean function which indicates if the glyph can be drawn for the button glyph. The return value is determined by examining the value in the ShowMode property. Values in the TGlyphShowMode enumeration determine the return value using the following logic:

gsmAlways
Return value is True
gsmNever
Return value is False
gsmApplication
Uses the Application.ShowButtonGlyphs property to determine the return value
gsmSystem
Uses the value from SystemShowButtonGlyphs as the return value
The return value is always True at design-time.

Use CanShowGlyph to determine if an image is available to be drawn on the button.

True when the glyph can be displayed on the button. Determines if an image is available for the button glyph.

CanShowGlyph is a Boolean function used to determine if an image is available for the button glyph. The return value is True when an image has been specified using one of the following mechanisms (in the order of precedence):

  • Images is assigned and contains valid button state images
  • LCLGlyphName contains a non-empty resource name
  • ExternalImages is assigned and contains a valid ExternalImageIndex value
True when a glyph image is available. Performs actions needed when the glyph image has been changed for the class instance.

DoChange is a procedure used to performs actions needed when the glyph image has been changed for the class instance. DoChange signals the OnChange event handler (when assigned).

Provides a default implementation for the OnChange event handler.

GlyphChanged is procedure which provides the default implementation for the OnChange event handler. Sender is the TObject instance for the change notification, and normally receives a reference to the current TButtonGlyph class instance.

GlyphChanged ensures that the internal ImagesCache member is set to Nil, and the ClearImages methods is called to remove images stored in the Images property. When CanShow returns True, the internal ImagesCache member is re-populated and registered to listen for changes to the Glyph property.

GlyphChanged is assigned to the OnChange event handler when the class instance is created, and when a bitmap is assigned to the Glyph property.

Button glyph for the change notification. Sets the value for the TransparentMode property.

SetTransparentMode is a procedure used to set the value in the TransparentMode property to the specified TGlyphTransparencyMode value. SetTransparentMode ensures that the bitmap in the Glyph property is updated to use the same transparency mode.

SetTransparentMode is not the write access specifier for TransparentMode, which is a read-only property.
Value stored in the TransparentMode property. Indicates the transparency mode used to render the glyph image.

TransparentMode is a read-only TGlyphTransparencyMode property used to indicate the transparency mode applied when the glyph image is drawn.

Use SetTransparentMode to change the value for the property.

Create - constructor for TButtonGlyph: frees the Images cache then creates a Glyph Bitmap.

If you drop a component on the form in the form editor, you don't need to add code to explicitly create it. The component is automatically created together with the form, and destroyed when the form is destroyed.

However, if you create the component by code, don't forget to free it when it is no longer needed. Constructors allocate memory and system resources needed by the object. They also call the constructor for any sub-objects present in the class.

Destroy - destructor for TButtonGlyph: frees caches and calls inherited Destroy.

If you call Destroy for an object which hasn't been initialized yet, it will generate an error. Always use the Free method to deallocate objects, because it verifies that the object does not contain the value Nil.

Take the following precautions when creating your own Destroy method:

  • Declare Destroy with the override directive, because it is a virtual method.
  • Always call the inherited Destroy method as the last action in the destructor code.
  • An exception may be raised in the constructor if there is not enough memory to create an object, or something else goes wrong. If the exception is not handled inside the constructor, the object will be only partially built. In this case Destroy will be called, so your destructor must check if the resources were really allocated before the are released.
  • Remember to call Free for all objects created on the constructor.
TObject.Destroy
Gets the index for a button image using a given state, and the effect used to draw it.

GetImageIndexAndEffect is a procedure used to get the ordinal position for the image used to render the Glyph for the class instance. In addition, it returns the image resolution for the specified display density and the drawing effect for the button State.

GetImageIndexAndEffect uses ThemeServices to determine if drawing effects are automatically applied to glyph images, and captures the effect in the AEffect output argument.

GetImageIndexAndEffect determines the image source and the ordinal position for the image used for the button glyph. ExternalImages and ExternalImageIndex are used (when assigned). The next available source is the resource name specified in LCLGlyphResourceName (when specified). Finally, the Images property is used (when assigned). When the image source has been determined, the correct image resolution for the value in APPI is selected and stored in AImageResolution. ImageIndexes is used to get the position for the image with the specified button State.

GetImageIndexAndEffect is used in in the implementation of the Draw method in TButtonGlyph, and in the GetGlyphSize method in TCustomSpeedButton.

Drawing state for the button glyph. Pixels per inch for the image resolution with the button glyphs. Canvas scaling factor applied to the image resolution. Returns the scaled image resolution with the button glyphs. Returns the index for the glyph image selected from Images or LCL glyph resources Returns the drawing effect needed for the glyph image with the specified state. Draws the glyph for the button using the specified settings and state.

Draw is a method used to draw the glyph for the button using the target and configuration specified in the arguments. Draw is overloaded to provide a variant which uses a scaling factor for the glyph image.

Canvas is the TCanvas instance where the glyph is rendered.

Client is a TRectangle instance with the client coordinates for the drawing operation.

Offset is a TPoint instance which contains the offset where the glyph is drawn in the Client rectangle.

State contains the button drawing state and is used to get both the glyph image and graphic drawing effect applied in the method.

Transparent indicates if the glyph is draw transparently.

PPI indicates the display density for the image resolution requested in the method.

ScaleFactor is the canvas scaling factor applied when the image is drawn.

Images used for button glyphs can be loaded from three (3) different sources.

  • LCLGlyphResourceName property
  • ExternalImages property
  • Images property

By default, the LCL Glyph resource is used when the button is created. Setting values for the corresponding properties changes the source for the glyph image.

Draw calls GetImageIndexAndEffect to get the image resolution needed for the value in PPI, and the index for the image drawn in the method. The TScaledImageListResolution.Draw method is called to render the selected glyph in the resolution to the Canvas using the Client, Offset, and derived graphics drawing effect.

No actions are performed in the method when an bitmap has not been assigned to the Glyph property, when the coordinates in Client are invalid, or when an image resolution / image index was not found.

The return value is a TRectangle instance with the original value passed in Client. Please note, this is different than the Delphi VCL; it returns the text rectangle.

TScaledImageListResolution
Rectangle where the glyph was drawn. Canvas where the glyph is rendered. Client coordinates for the drawing operation. Offset in the client coordinates where the glyph is drawn. Button state. True if the glyph is drawn transparently. Not used in the current implementation. Pixels Per Inch for the image resolution requested in the method. Canvas scaling factor used in the method. Updates the button glyph after changes to property values. The bitmap image drawn as the glyph on the button.

Glyph is a TBitmap property with the bitmap image drawn as the glyph for the class instance. The value in Glyph is created/loaded when a bitmap is assigned directly to the property, or when loaded from a Lazarus resource or stock icon.

Assigning a new TBitmap value to Glyph causes the reference in ExternalImages to be discarded. The GlyphChanged method is assigned to the OnChange event handler in the bitmap to track changes to the image. If the Bitmap contains multiple adjacent images (determined using Width and Height), the NumGlyphs property is updated to contain the number of glyphs stored in the bitmap. The Refresh method is called to update the button glyph following changes to its property values.

Indicates whether change notifications are suppressed while editing property values.

IsDesigning is a Boolean property which indicates whether change notifications are suppressed while editing property values for the button glyph. The default value for the property is False, as assigned in the Create constructor.

Set IsDesigning to True to prevent calls to the Refresh method following a change to the ShowMode property, or when getting/setting the image for the button Glyph. Controls which use TButtonGlyph, like TBitBtn and TSpeedButton, will update the property to indicate whether the ComponentState for the control includes the csDesigning enumeration value. This has the net effect of disabling OnChange notifications at design-time.

The number of glyphs available for button states.

NumGlyphs is a TNumGlyphs property which indicates the number of glyphs available for its button states. The default value for the property is 1 (the low value for the range), and indicates that a single image is used for all button states in the TButtonGlyph.

The value in NumGlyphs is updated when a TBitmap instance is directly assigned to the Glyph property, and when GetImageIndexAndEffect retrieves the Images and drawing effect(s) for a given display density (PPI).

Reading the value in NumGlyphs causes the ExternalImages property to be examined; when it is assigned, the value for the property is always 1 (corresponding to the ExternalImageIndex). Otherwise, the value in the internal member is used.

Changing the value in NumGlyphs causes the Refresh method to be called.

The list of available images for the button glyph.

Images is a read-only TCustomImageList property which contains the images available for the Glyph in the class instance. The values in Images come from ExternalImages (when an image list has been assigned to its button control). The values may come from the list of bitmaps loaded from the glyph resource with the name in LCLGlyphName.

ExternalImages (when assigned) is used as the source for the Images in the class instance. The images with the resolution needed for the display density (PPI) are scaled to the ExternalImageWidth and stored in Images. LCLGlyphName (when assigned) is used to retrieve a resource in LCLGlyphs when ExternalImages are unassigned.

See for more information about image retrieval for the button glyph with a given state.

Stores the standard LCL resource name used for the Glyph in the class instance.

LCLGlyphName is a String property used to store the name for the LCL resource used as the Glyph for the class instance. Changing the value in LCLGlyphName causes existing entries in Images and ExternalImages to be removed, and the OnChange event handler to be signalled. The Image lists are not modified when the property is set to an empty string ('').

LCLGlyphName normally contains a value like those in BitBtnResNames, and represents a standard resource name used in the LCL.

Contains a reference to an external list of images that can be used as the Glyph image,

ExternalImages is a TCustomImageList property with the list of images that can be displayed as a glyph for the class instance. ExternalImages represents an image list assigned to the Images property for a button control, like TBitBtn or TSpeedButton. The image list contains bitmaps displayed for the various states for an associated button; i. e. Up, Pressed, Hot, Disabled, or Selected. The image used for a given button state is indicated in the properties: ExternalImageIndex, ExternalHotImageIndex, ExternalDisabledImageIndex, ExternalPressedImageIndex, and ExternalSelectedImageIndex.

Values in ExternalImages are used when a glyph bitmap has not been allocated in the Glyph property. Setting a new value for ExternalImages causes the Glyph property to be cleared, and the OnChange event handler is signalled. Conversely, setting a value for the LCLGlyphName property causes the reference in ExternalImages to be discarded.

Bitmaps in ExternalImages (or Glyph) are stored in the Images property, and used in the GetImageIndexAndEffect method to determine the image resolution and bitmap used for the glyph and the button state.

Use ExternalImageWidth to specify the Width of the images in the ExternalImages container.

Width for the images in the ExternalImages property.

ExternalImageWidth is an Integer property with the Width for the images in the ExternalImages property. The property value is used to determine the image resolution needed for the Images displayed in the GetImageIndexAndEffect method.

Changing the value for the property causes the OnChange event handler to be signalled (when assigned).

Ordinal position for the bitmap in ExternalImages displayed when the button is Up (not pressed).

ExternalImageIndex is a Integer property with the ordinal position for the bitmap drawn on the control when the button is in the Up (not pressed) state. ExternalImageIndex is an indexed property which accesses the value stored in an internal array of image indexes for each of the button states. The property value contains the ordinal position in ExternalImages with the bitmap used for the button state. -1 indicates that an explicit value has not been assigned for the property.

Modified in LCL version 2.3.0 to use an internal array of button states for the property value.
Ordinal position in ExternalImages for the image displayed when the button is Hot (hovered).

ExternalHotImageIndex is an indexed property which accesses the value stored in an internal array of image indexes for each of the button states. The property value contains the ordinal position in ExternalImages with the bitmap used for the button state. -1 indicates that an explicit value has not been assigned for the property.

Added in LCL version 2.3.0. Available since version 3.0.
Ordinal position in ExternalImages for the image displayed when the button is Disabled.

ExternalDiasabledImageIndex is an indexed property which accesses the value stored in an internal array of image indexes for each of the button states. The property value contains the ordinal position in ExternalImages with the bitmap used for the button state. -1 indicates that an explicit value has not been assigned for the property.

Added in LCL version 2.3.0. Available since version 3.0.
Ordinal position in ExternalImages for the image displayed when the button is Pressed (down).

ExternalPressedImageIndex is an indexed property which accesses the value stored in an internal array of image indexes for each of the button states. The property value contains the ordinal position in ExternalImages with the bitmap used for the button state. -1 indicates that an explicit value has not been assigned for the property.

Added in LCL version 2.3.0. Available since version 3.0.
Ordinal position in ExternalImages for the image displayed when the button is Selected (has focus).

ExternalSelectedImageIndex is an indexed property which accesses the value stored in an internal array of image indexes for each of the button states. The property value contains the ordinal position in ExternalImages with the bitmap used for the button state. -1 indicates that an explicit value has not been assigned for the property.

Added in LCL version 2.3.0. Available since version 3.0.
The Width of the Glyph image.

Width is an Integer property with the Width for bitmaps displayed in the class instance. When Images has been assigned, its Width is used as the property value. Otherwise, the property value is 0.

Width is used when a value is assigned to the Glyph property, and determines if multiple images are present in the bitmap loaded into the Images property.

The height of the glyph image.

Height is an Integer property with the height for bitmaps displayed in the class instance. When Images has been assigned, its Height is used as the property value. Otherwise, the property value is 0.

Height is used when a value is assigned to the Glyph property, and determines if multiple images are present in the bitmap loaded into the Images property.

Indicates the logic used to display the Glyph image for the class instance.

ShowMode is a TGlyphShowMode property which indicates logic used to display the Glyph image for the class instance.

The default value for the property is gsmApplication, and indicates that ShowButtonGlyphs in TApplication determines the visibility of the button Glyph. See for more information about TGlyphShowMode enumeration values and their usage in TButtonGlyph.

Changing the value for the property causes the Refresh method to be called at run-time (IsDesigning contains False).

Event handler signalled when the bitmap in Glyph has been changed.

OnChange is a TNotifyEvent property with the event handler signalled when the image used in the Glyph property is changed. OnChange is signalled from the DoChange method, and occurs after Glyph has been loaded using the resource or image lists available to the class instance.

TButtonGlyph provides a default implementation for the event handler in its GlyphChanged method.

TBitBtnKind - enumerated type of possible kinds of BitButtons.

TBitBtnKind is an enumerated type with values which indicate the intended use for a TCustomBitBtn / TBitBtn instance. Values in TBitBtnKind are used to select the appropriate image displayed as the glyph for TBitBtn class instances. TBitBtnKind is the type used to implement the Kind property in TCustomBitBtn.

Uses a custom image on a button. Uses the OK button image. Uses the CANCEL button image. Uses the HELP button image. Uses the YES button image. Uses the NO button image. Uses the CLOSE button image. Uses the ABORT button image. Uses the RETRY button image. Uses the IGNORE button image. Uses the ALL button image. Uses the NO TO ALL button image. Uses the YES TO ALL button image. TBitBtnKinds - set of TBitBtnKind.

Not used in the current LCL implementation.

TCustomBitBtn - the ancestor class for TBitBtn.

TCustomBitBtn is a TCustomButton descendant, and the ancestor for TBitBtn. It provides the interface used to display a button with a glyph (or image) and a caption. It performs an action when the button is clicked.

If you want to define your own bitmap button class, you should derive it from this class.

Gets the value for the Glyph property. Value for the Glyph property. Gets the value for the GlyphShowMode property. Value for the GlyphShowMode property. Gets the value for the NumGlyphs property. Value for the NumGlyphs property. Performs a change notification when Images for the control are updated.

ImageListChange is a procedure used to perform a change notification when the Images for the control have been updated.

Sender is the TObject instance generating the change notification. ImageListChange compares Sender to the object in the Images property, and calls the GlyphChanged method when they are the same instance.

ImageListChange is assigned to the OnChange event handler in the internal TChangeLink member used in the class.

Object generating the change notification. Gets the storage specifier for the Glyph property.

IsGlyphStored is a Boolean function used to get the storage specifier for the Glyph property. The return value is True when an image has not already been assigned in the Action property, or in the TButtonGlyph constructed for the control. This ensures that the image is included in processing that occurs for the LCL component streaming mechanism.

True when the glyph image is stored in the LCL component stream. Sets the value for the Glyph property. New value for the Glyph property. Sets the value for the GlyphShowMode property. New value for the GlyphShowMode property. Sets the value for the Kind property. New value for the Kind property. Sets the value for the Layout property. New value for the Layout property. Sets the value for the Margin property. New value for the Margin property. Sets the value for the NumGlyphs property. New value for the NumGlyphs property. Sets the value for the Spacing property. New value for the Spacing property. Loads and configures properties for the Kind value in the control.

RealizeKind is a procedure used to load and configure properties for the control. RealizeKind ensures that the Glyph displayed on the control contains a valid image for the value in the Kind property. When Kind contains bkCustom, it is assumed that the image was assigned directly to the Glyph property. For all other values, the following logic is used to derive the Glyph image:

  1. Call GetDefaultBitBtnGlyph to get a user-supplied bitmap for the glyph (when available).
  2. Use ThemeServices to get a "stock" image supplied by the widget set (when available).
  3. Use the graphic stored in Images at the position in ImageIndex (when assigned).
  4. Load the Glyph image from a LCL resource for the specified Kind.

ForceDefaults indicates if default values are applied to properties in the control. When it contains True, the following properties are updated:

  • Caption
  • ModalResult
  • Default
  • Cancel

RealizeKind is called when the value in the Kind property is changed, and when the control has been Loaded using the LCL component streaming mechanism.

True if the default values for properties are used in the control. Sets the value for the DefaultCaption property.

SetDefaultCaption is the write access specifier for the DefaultCaption property. AValue contains the new value assigned to the property.

When AValue is True, and Kind contains a value other than bkCustom, the Caption property is updated to use the value returned from GetCaptionOfKind. This also causes the TextChanged method to be called when the Caption property is updated.

New value for the property. Gets the default Caption value for the button Kind. Default value for the Caption property. Enumeration value that identifies the kind of BitButton. Gets the value for the Images property. Value for the Images property. Sets the value for the Images property. New value for the Images property. Gets the value for the ImageIndex property. Value for the ImageIndex property. Drawing state for the requested button glyph. Sets the value for the ImageIndex property. New value for the ImageIndex property. Identifies the drawing State for the specified image index. Gets the value for the ImageWidth property. Value for the ImageWidth property. Sets the value for the ImageWidth property. New value for the ImageWidth property. An internal member which contains the TButtonGlyph instance for the control. Performs action when a new value is assigned to the Action property for the control.

ActionChange is overridden in TCustomBitBtn to ensure that values from the new action instance in Sender are stored to properties in the control. ActionChange is the routine which implements the OnChange event handler for the ActionLink in the control. It is signalled (from TControl) when a new value is assigned to the Action property, or when the control is loaded using LCL component streaming.

Sender is the new action instance for the event, or Nil when the value in Action has been removed (set to Nil).

CheckDefaults indicates whether existing properties values in the control are used as default values. When set to False, the values from the action instance are applied to the control. Values from the action may be used (when assigned) if the properties in the control are unassigned - even when CheckDefaults is True.

ActionChange calls the inherited method to update property values like Caption, Enabled, Hint, Visible, HelpContext and HelpKeyword. When Sender is a TCustomAction instance, the values in ImageIndex and Images are also updated with the values from the action (when assigned).

New action instance for the event. True to use existing properties as default values, False to use properties from the new action. Performs actions needed when the value in Glyph has been changed.

Ensures that the widget set class is notified of a change in the value for the Glyph property. Calls InvalidatePreferredSize and AdjustSize to resize the control for the new Glyph image.

Assigned to the OnChange event handler in the TButtonGlyph instance for the control, and called directly from the ImageListChange method.

TObject instance for the change notification. Gets the storage specifier for the Caption property. True when a value for the property is included in the LCL component streaming mechanism. Performs actions needed when the component has been loaded using LCL component streaming.

Loaded is an overridden method in TCustomBitBtn, and calls the inherited method on entry. It ensures that properties in the class instance are updated when a value other than bkCustom is used in the Kind property. This includes loading the Glyph image and setting values in Caption, ModalResult, Default, Cancel, ImageIndex, and DefaultCaption.

TCustomButton.Loaded
Performs actions needed when a sub-component is added or removed in the class instance.

Ensures that a TCustomImageList reference in the button glyph is Nil'd when the image list is freed.

TControl.Notification
Component for the notification message. Operation performed for the notification message. Performs actions needed when the CM_TEXTCHANGED control message is handled for the control.

TextChanged is an overridden method in TCustomBitBtn. It ensures that the control is updated when the value in the Caption property has been changed. AdjustSize is called to auto-size a visible control and its parent. The value in DefaultCaption is set to False after the new value has been assigned for the Caption property.

TControl.TextChanged
Handles the CM_APPSHOWBTNGLYPHCHANGED message for the control.

CMAppShowBtnGlyphChanged is a method used to handle the CM_APPSHOWBTNGLYPHCHANGED control message for the control. It ensures that the bitmap in Glyph is refreshed when the value in the GlyphShowMode property is set to gsmApplication.

TGlyphShowMode
Control message handled in the method. Constructor for the class instance.

Create is the constructor for the class instance. Create calls the inherited constructor, and initializes the layout, style, spacing, and Button Glyph for the control.

TComponent.Create TCustomButton.Create
Owner of the class instance. Destructor for the class instance.

Destroy is the overridden destructor for the class instance. It ensures that resource allocated for the internal button glyph and image change link are freed. It calls the inherited destructor prior to exiting from the method.

TComponent.Destroy
Performs actions needed when the button is clicked.

Click is an overridden method in TCustomBitBtn. It ensures that the correct actions are performed based on the value in the Kind property. When Kind is set to bkClose, the non-nested parent form is closed for the following conditions:

  • ModalResult is set to mrNone, or
  • ModalResult is mrCancel and the parent form is displayed as a modal dialog.

If Kind has any other value, the inherited Click method is called to determine the ModalResult and signal the OnChange event handler (when assigned).

Click is called when the DialogChar method handles an accelerator key for the control, when the Action for the control is executed, and when a mouse click event is handled for the control.

TCustomButton.Click TButtonControl.Click TControl.Click
Loads the Glyph image with the specified named from a resource instance.

Calls the LoadGlyphFromLazarusResource routine in buttons.pas to load the bitmap for the specified resource name into the Glyph for the button control.

Modified in LCL version 4.0 to use the TLCLHandle type for the Instance argument instead of the deprecated THandle type. TLCLHandle
Handle for the resource instance where the glyph image is stored. Resource name for the glyph loaded in the method. Loads a glyph image from the Lazarus resource file (.lrs). Name for the resource loaded from the Lazarus resource file. Loads a stock glyph image for the specified button identifier. Button identifier used to determine the image loaded in the Glyph. Loads the glyph image for the specified button identifier from the internal LCL resource.

LoadGlyphFromResource is a method used to load the glyph for the specified button identifier from the internal LCL resource with the button images. idButton contains a value in the TButtonImage range for the button identifier. No actions are performed in the method if idButton is not in the TButtonImage range.

LoadGlyphFromResource calls the LoadGlyphFromResource routine using the resource name in BitBtnResNames for the button identifier.

Button identifier for glyph image loaded in the method. Indicates if the Glyph for the button can be displayed.

CanShowGlyph is a Boolean function which indicates if the Glyph for the button can be displayed. The return value contains the result from the CanShowGlyph method in the internal TButtonGlyph member.

AWithShowMode indicates whether the ShowMode property for the button glyph is examined in the method by calling the CanShow method in TButtonGlyph.

True when the Glyph image can be displayed for the control. Indicates if the ShowMode for the glyph is examined in the method. Contains the descriptive text displayed for the Bitmap button control.

Caption is a public TCaption property which contains the descriptive text displayed for the Bitmap button control. Assign a value to Caption when the Kind property is set to bkCustom. When Kind contains one of the other TBitBtnKind enumeration values, the Caption is normally set using the GetCaptionOfKind method.

Use DefaultCaption to determine if the value in Caption is the default one for the control.

TControl.Caption
Indicates if Caption contains the default value for the button Kind.

Changing the property value to True causes a resource string with the caption text for the button ID to be assigned to the Caption property when Kind is not bkCustom.

Ordinal position for the image displayed when the button is Disabled.

DisabledImageIndex is a TImageIndex property with the ordinal position for the bitmap displayed on the button when it is Disabled. It refers to the position in the Images property where the associated image data is stored. The default value for the property is -1, and indicates that an explicit value has not been assigned to the property.

The Lazarus IDE provides a property editor that allows selection of one of the Images from a drop-down image list. The position for the selected image is stored as the property value in the Object Inspector.

Added in LCL version 2.3.0. Available since version 3.0.
Bitmap with the Glyph displayed on the control.

Glyph is a TBitmap property with bitmap(s) displayed on the button control. The bitmap is stored internally in a TButtonGlyph instance that is populated when a glyph resource is used for image(s) on the control. A bitmap can be assigned directly to the property. Or, it can be loaded when the LoadGlyphFromResourceName, LoadGlyphFromLazarusResource, or LoadGlyphFromStock method is called.

Glyph can contain a bitmap with multiple adjacent images representing the states for the button control. Use ImageWidth to define the Width for individual images in the combined bitmap. If the bitmap has a Width that is larger than ImageWidth, it is split into separate bitmaps for use in the internal TButtonGlyph instance. Use ImageIndex, DisabledImageIndex, HotImageIndex, and PressedImageIndex to indicate which bitmap is used for the corresponding button state.

Unlike TCustomSpeedButton, SelectedImageIndex is not available in TCustomBitBtn; it cannot receive input focus, so a selected image is neither needed nor implemented.
The number of glyph bitmaps available for the control.

NumGlyphs is a TNumGlyphs property with the number of images in the bitmap assigned to the Glyph property. The property value is read from and written to the internal TButtonGlyph instance for the control. Changing the value for the property causes the original image to be re-examined and split into separate images based on the Width specified in the ImageWidth property.

Ordinal position for the bitmap displayed when the button control is hot (hovered).

HotImageIndex is a TImageIndex property with the ordinal position for the bitmap displayed on the button when it is hot (under the mouse cursor - hovered). It refers to the position in the Images property where the associated image data is stored. The default value for the property is -1, and indicates that an explicit value has not been assigned to the property.

The Lazarus IDE provides a property editor that allows selection of one of the Images from a drop-down image list. The position for the selected image is stored as the property value in the Object Inspector.

Added in LCL version 2.3.0. Available since version 3.0.
Contains the list of images available for use as the glyph on a custom button control.

Images is a TCustomImageList property with the images which can be displayed as the glyph for the various states on the button control. Images provides an alternative to assigning a bitmap to the Glyph property, and is used when the Kind property is set to bkCustom.

Use ImageWidth to set the image resolution size used when a value is retrieved from the Images property.

Use ImageIndex to specify the ordinal position for the value in Images displayed as the glyph for the button control.

Use the HotImageIndex, PressedImageIndex, and DisabledImageIndex properties to specify the position for the image displayed for the corresponding button states.

TCustomImageList
Ordinal position for the default bitmap displayed when the button control is up (not pressed).

ImageIndex is a TImageIndex property with the ordinal position for the bitmap displayed on the button when it is in its default state (up). It refers to the position in the Images property where the associated image data is stored. The default value for the property is -1, and indicates that an explicit value has not been assigned to the property.

Added in LCL version 2.3.0. Available since version 3.0.
Width for the value in Images displayed on the button control.

ImageWidth is an Integer property with the Width in pixels for the TCustomImage instances stored in the Images property. The default value for the property is 0, and indicates that an explicit value has not been assigned for the property. This causes the Width property in the TCustomImageList to be used for an image retrieved from the list.

Changing the property value causes the internal TButtonGlyph instance in the class to be updated with the new value. InvalidatePreferredSize is called to recalculate the preferred dimensions for the class instance. AdjustSize is called to auto-size a visible control and its parent.

Specifies the button kind including the default bitmap and caption for the button control.

Kind is a TBitBtnKind property which identifies the intended usage for the button control. The enumeration value indicates the default values used in the Glyph and Caption for the control. The default value for the property is bkCustom, and causes values in Glyph (or the image in ImageIndex) and Caption to be displayed on the button surface.

Changing the property value causes other values in the class instance to be updated. When Kind has a value other than bkCustom, the default Glyph is retrieved and stored using the GetDefaultBitBtnGlyph, ThemeServices, or resources from BitBtnImages and BitBtnResNames. Values in Caption, ModalResult, Default, Cancel and DefaultCaption are updated as needed for the new value in Kind.

Layout or alignment for the glyph bitmap and caption on the control.

Layout is a TButtonLayout property which indicates the alignment used for the Glyph (or image) and the Caption on the button control. The default value for the property is blGlyphLeft. It causes the Margin, Glyph (or image), Spacing, and Caption to be aligned to the left edge of the button surface.

Changing the property value causes the widgetset class instance to be updated when its handle has been allocated. InvalidatePreferredSize is called to recalculate the preferred dimensions for the control. AdjustSize is called to auto-size a visible control and its parent.

The property value is used in the InitializeWnd method to set the initial value in the widget class instance.

Use Margin to set the space reserved prior to the glyph bitmap on the aligned edge of the control. Use Spacing to set the space reserved between the Glyph image and the Caption relative to the aligned edge of the control.

The space prior to the glyph bitmap on the aligned edge of the button layout.

Margin is an Integer property with the space reserved prior to the Glyph or image displayed on the button control. It occurs on the aligned edge specified in Layout, and refers to a number of pixels. The value -1 has special meaning; it causes the glyph and caption to be centered on the button surface.

The default value for the property is -1. Changing the property value causes the widgetset class instance to be updated when its handle has been allocated. AdjustSize is called to auto-size a visible control and its parent. At design-time, the Invalidate method is called to redraw the control.

The property value is used in the InitializeWnd method to set the initial value in the widget class.

Use Layout to specify the edge on the button control to which the glyph bitmap and caption are aligned.

Use Spacing to set the space reserved between the glyph bitmap and the caption for the control.

Ordinal position for the bitmap displayed when the button control is pressed (down).

PressedImageIndex is a TImageIndex property with the ordinal position for the bitmap displayed on the button when it is pressed (down). It refers to the position in the Images property where the associated image data is stored. The default value for the property is -1, and indicates that an explicit value has not been assigned to the property.

The Lazarus IDE provides a property editor that allows selection of one of the Images from a drop-down image list. The position for the selected image is stored as the property value in the Object Inspector.

Added in LCL version 2.3.0. Available since version 3.0.
The space reserved between the bitmap and the caption on the button control.

Spacing is an Integer property with the number of pixels used to separate the Glyph (or image) displayed on the button and its Caption. The default value for the property is 4 pixels.

The number of pixels in Spacing is always displayed - even when the Caption is an empty string. To suppress drawing of the additional space, set the property to 0.

Changing the value for the property causes the widgetset instance to be updated when its handle has been allocated. AdjustSize is called to auto-size a visible control and its parent. At design-time, the Invalidate method is called to redraw the control.

The property value is used in the InitializeWnd method to set the initial value in the widget class.

Use Layout to specify the edge on the button control to which the glyph bitmap is aligned.

Use Margin to set the space reserved on the aligned edge prior to the glyph bitmap.

For the macOS Carbon widgetset, the Spacing property is not supported. Layout and alignment is determined by the native control for the platform.
Indicates the policy for showing or hiding the glyph image for the button. TGlyphShowMode TApplication.ShowMenuGlyphs A button with a small image attached.

TBitBtn is a TCustomBitBtn descendant which provides the interface used to display a button with a glyph (or image) and a caption. It performs an action when the button is clicked.

TBitBtn sets the visibility for properties introduced in ancestor classes.

How To Use Standard Controls
Indicates if the control is visible on its parent.

The Visible property indicates the ability to see a visual control. If Visible is True, the control is shown, otherwise it is hidden. Calling Show sets Visible to True. Setting Visible to False is equivalent to calling the Hide method.

The Visible property does not depend on the visibility of a parent control. Use IsVisible method to consider this, and get the real visibility for a control in its parent container.
TControl.Visible
Event handler signalled when a key is down while the control has focus.

OnKeyDown differs from OnKeyPress in that the key may have already been down when the control received focus; with OnKeyPress the key needs to become pressed while the control has focus.

TWinControl.OnKeyDown
Event handler signalled when a key is pressed while the control has focus.

OnKeyPress differs from OnKeyDown in that the key needs to become pressed while the control has focus; with OnKeyDown the key may have already been down when the control received focus.

TWinControl.OnKeyPress
Event handler signalled when a key is released while the control has focus.

In OnKeyUp, the key may already have been up when the control received focus, or a pressed key may become released during the time the control has focus.

TWinControl.OnKeyUp
Links a TSpeedButton with a TAction instance. Sets the group index for the speed button in the action link.

SetGroupIndex is an overridden method in TSpeedButtonActionLink. It implements the empty virtual method from the ancestor class. SetGroupIndex call IsGroupIndexLinked to determine if the action link has an assigned speed button instance. When assigned, the GroupIndex property in the client control is set to Value.

SetGroupIndex is called when a TCustomAction instance notifies each of its client controls of a new value for the group index property in the class instance.

TCustomAction.GroupIndex TCustomActionList
New value for the group index in the linked speed button. Sets the Checked state for the control in the action link. New value for the Checked state in the linked speed button control. Sets the image index in the control for the action link when enabled.

SetImageIndex is an overridden method used to change the selected image in the associated TSpeedButton control for the action link. SetImageIndex uses the value from IsImageIndexLinked to determine if the image can be changed by the action link. When IsImageIndexLinked returns False, no actions are performed in the method.

SetImageIndex accesses the internal TSpeedButton control for the action link, and sets its ImageIndex property to the ordinal position specified in Value.

TActionLink.SetImageIndex
Ordinal position for the image selected in the speed button control. Determines whether the action link can update the image index for the associated control.

IsImageIndexLinked is an overridden Boolean function used to determine if the Action Link can update the image in its associated TSpeedButton control. The return value is True when the Action is derived from TCustomAction and the ImageIndex values in the TSpeedButton and the Action currently have the same values.

IsImageIndexLinked is called from the SetImageIndex method before updating the value in the ImageIndex for the TSpeedButton control.

TBasicActionLink.Action
Returns True when the action is can update the image in the associated control. The ancestor for the TSpeedButton class.

TCustomSpeedButton is a TGraphicControl descendant, and the ancestor for TSpeedButton. If you want to define your own speed button class, you should derive it from TCustomSpeedButton.

A speed button is designed to automatically perform a process when it is pressed or clicked. The user can push the button to start an action or set a mode. When a user clicks on a speed button, focus is not shifted; a speed button never receives focus. The button may have a descriptive glyph (symbol or pictograph), and has state (checked, unchecked, Up, Down, Hovered, Selected, Disabled).

Gets the value for the Glyph property. Value for the property. Performs actions needed when the value in Images is changed.

ImageListChange implements a handler routine assigned to the OnChange event handler in the internal image change link for the speed button. It is assigned in the Create method when the TChangeLink is created for the control.

TChangeLink.OnChange
Object for the event notification. Gets the storage specifier for the Glyph property. True when a value for the Glyph property is included in the LCL component streaming mechanism. Sets the value for the ShowCaption property. New value for the property. Sends a message to the parent control when the value in AllowAllUp, GroupIndex, or Down is changed. Gets the value for the Transparent property. Value for the Transparent property. Sets the value for the Alignment property. New value for the Alignment property. Sets the value for the AllowAllUp property. New value for the property. Sets the value for the Glyph property. New value for the property. Sets the value for the Layout property.

Calls InvalidatePreferredSize to reset control flags which cause the preferred size to be recalculated. Calls AdjustSize to apply smart (delayed) resizing for the control.

New value for the property. Sets the value for the ShowAccelChar property. New value for the property. Sets the value for the Transparent property. New value for the property. Handles the Control message passed when the button is pressed.

CMButtonPressed is a method used to handle a CM_BUTTONPRESSED control message received for the control. CMButtonPressed ensures that the Down property is set to False when another speed button with the same GroupIndex is pressed. AllowAllUp is updated and the control is redrawn.

No actions are performed in the method when the control in Message does not have the same GroupIndex value.

TLMessage instance examined in the method. Handles the Control message passed when the Enabled state is changed.

CMEnabledChanged is a method used to handle the CM_ENABLEDCHANGED control message. It re-implements the method from the ancestor class, and does not call the inherited method. CMEnabledChanged calls UpdateState to (re-)create the glyph using the new state for the speed button and to invalidate the drawing area for the control.

TControl.CMEnabledChanged
Message handled in the method. Gets the value for the Images property. Value for the property. Sets the value for the Images property. New value for the property. Gets the value for the ImageIndex property. Value for the property. Drawing state for the requested glyph image. Sets the value for the ImageIndex property. Drawing state for the specified glyph image. New value for the property. Gets the value for the ImageWidth property. Value for the property. Sets the value for the ImageWidth property. New value for the property. Internal member used to store the TButtonState for the control. Gets the TButtonGlyph used for the control. TButtonGlyph instance used for the control Gets the value for the NumGlyphs property. Value for the property. Performs actions needed when the value in the Glyph property has been changed.

GlyphChanged implements the handler routine used for the OnChange event handler in the Glyph for the control. It is assigned in the Create constructor. GlyphChanged calls Invalidate to request the control to be redrawn when the glyph image is updated.

TControl.Invalidate
TObject instance for the change notification. Calculates the default height and Width required for the control.

CalculatePreferredSize is an overridden method in TCustomSpeedButton. It calls MeasureDraw to gets the values for the variable parameters in PreferredWidth and PreferredHeight. If WithThemeSpace is enabled, additional spacing is reserved in PreferredWidth and PreferredHeight for theme element details; both arguments are increased by six (6) pixels.

CalculatePreferredSize is called from the GetPreferredSize method (in TControl) when control flags indicate the value has not already been determined.

In previous LCL versions, CalculatePreferredSize did not use the WithThemeSpace argument or adjust the preferred size when it was enabled. As a result an auto-sized control would truncate the Caption displayed for a TSpeedButton control. This behavior has been changed in LCL version 4.0. An auto-sized speed button is now increased in size for theme spacing. This can lead to misaligned buttons in applications or descendent classes which handled the condition independently. Descendent classes may need to implement an overridden CalculatePreferredSize method and reduce the preferred size by the pixels added in the base class. Applications can use anchoring or aligning to align the borders on speed button controls.
Modified in LCL version 4.0 to include support the WithThemeSpace argument. TControl.GetPreferredSize
Preferred width for the control. Preferred height for the control. Indicates if additional space is reserved in PreferredWidth and PreferredHeight for theme element details. Calculates the Width and Height for the layout used on the speed button and optionally renders the control.

MeasureDraw determines the space needed to draw the content for the speed button control. Values in the Caption, ShowCaption, Glyph, Margin, Spacing, and Layout properties are used to determine the layout for the control elements and the space needed to draw the control without clipping.

When Draw is enabled, the control is rendered to its Canvas using the State, Transparent and Layout settings. Otherwise, only measurements are performed in the method.

No actions are performed in the method if the Glyph property has not been assigned for the control; in this case, the output parameters in PreferredWidth and PreferredHeight are unchanged from their default values.

PaintRect contains the area where the control is drawn on its Canvas, and provides the bounds for the background on the control.

GetGlyphSize is called to get the dimensions for the glyph bitmap including any drawing effect applied in ThemeServices for the control State.

When Caption has been assigned and ShowCaption is enabled, the text size is included in the calculated space requirements. The values in Margins and Spacing are included in the horizontal or vertical size based on the value in Layout. Values in Alignment and UseRightToLeftReading are used when the text rectangle is calculated. If the Font matches the default System font settings, ThemeServices.DrawText is called to measure/render the text for the control.

Values in PreferredWidth and PreferredHeight are updated and returned to the calling routine in the output parameters.

Used in the implementation of the CalculatePreferredSize and Paint methods.

TGraphicControl.Canvas TControl.Caption TControl.UseRightToLeftReading TThemeServices.DrawText
True if the background and content for the control are drawn. False to calculate the preferred width and height only. Drawing area on the canvas where the content is positioned. Returns the preferred width calculated for the control. Returns the preferred height calculated for the control. Performs actions needed for a mouse down event on the control.

MouseDown is an overridden method in TCustomSpeedButton. It calls the inherited MouseDown method on entry to signal the OnEditingDone event for the active control on the Parent form. It also updates the DragManager coordinates when a drag operation is already active.

No additional actions are performed in the method at design-time.

If the Left mouse button was pressed when the control is Enabled, Down is set to True (when needed) and the Action for the control is unchecked. An internal flag for a pending drag operation in MouseMove is set prior to exiting from the method.

TControl.MouseDown
Button for the mouse event. Shift, Ctrl, or Alt modifier for the mouse event. Horizontal coordinate for the mouse pointer. Vertical coordinate for the mouse pointer. Performs actions needed for a mouse move message received for the control.

MouseMove calls the inherited method on entry to update the pointer position for the DragManager (when active) and to signal the OnMouseMove event handler (when assigned).

No additional actions are performed in the method at design-time.

if a drag operation has been started in MouseDown, the internal TButtonState for the control is updated to reflect the values in AllowAllUp and Down. When the button state has changed, the control is redrawn.

TControl.OnMouseMove TControl.MouseMove TControl.WMMouseMove
Shift, Ctrl, or Alt modifier for the mouse move event. Horizontal coordinate where the mouse pointer was moved. Vertical coordinate where the mouse pointer was moved. Button for the mouse event. Shift, Ctrl, or Alt modifier for the mouse up event. Horizontal coordinate for the mouse pointer. Vertical coordinate for the mouse pointer. Performs actions needed when a sub-component is added or removed for the control. Component for the notification message. Action performed for the notification message. Updates the state for the control, and paints it to the control Canvas.

Paint is an overridden method in TCustomSpeedButton used to draw the control to its Canvas.

Paint calls UpdateState to ensure that the internal TButtonState for the control is updated to reflect its current condition. No additional actions are performed in the method when a bitmap has not been assigned in the Glyph property.

When a Glyph is available, additional actions are performed to draw the control to its client rectangle. MeasureDraw is called to draw the background, Glyph, and Caption using the layout and state for the control.

Paint calls the inherited method prior to exit to signal the OnPaint event handler (when assigned).

TGraphicControl.Paint
Paints the background for the control to the specified rectangle.

PaintBackground is a method used to draw the background for the speed button control on its Canvas. When Transparent is True and the theme element has transparent areas, the value in Color is used to fill the drawing area in PaintRect.

The DrawElement method in ThemeServices is called to render the drawing area to the Canvas for the control. PaintRect is updated following the drawing operation with the reduced content rectangle (the button surface without borders/edges) needed for the control.

PaintBackground is called when the MeasureDraw method is used to render the control. The adjusted rectangle is later used in the method to calculate the drawing areas for the glyph bitmap and caption text.

ThemeServices TGraphicControl.Canvas
Rectangle where the control is drawn. Sets the value for the Down property. SetDown - specifies the Boolean value of Down (i.e. whether or not button was pressed) New value for the property. Sets the value for the GroupIndex property. SetGroupIndex - specifies the value of the Group Index. New value for the property. Sets the value for the Flat property. SetFlat - specifies whether or not the button is displayed Flat New value for the property. Sets the value for the Margin property.

SetMargin sets the size of the Margin used on the control. Calls InvalidatePreferredSize to update control flags which cause the preferred height and width for the control to be recalculated using the new Margin value. Calls adjust size to perform smart (delayed) resizing when needed. Calls Invalidate to redraw the control.

Modified in LCL version 4.0 to recalculate the size and redisplay the control when Margin is changed. TControl.InvalidatePreferredSize TControl.AdjustSize TControl.Invalidate
New value for the property. Sets the value for the NumGlyphs property. SetNumGlyphs - specifies the number of glyphs. New value for the property. Sets the value for the Spacing property.

SetSpacing specifies the spacing used between adjacent controls. Calls InvalidatePreferredSize to recalculate the preferred height and width for the control. AdjustSize is called to perform smart (delayed) resizing when needed. Invalidate is called to redraw the control.

Modified in LCL version 4.0 to recalculate preferred size and resize the control when the property is changed. TControl.InvalidatePreferredSize TControl.AdjustSize TControl.Invalidate
New value for the property.

Used by SetTextBuf to store a text string rather than performing read/write using a PChar buffer

Value stored in the method. Updates internal members used to track state changes in the control.

UpdateState brings the state up to date, implementing any pending changes, and rendering non-valid if InvalidateOnChange is True.

Indicates if the control is invalidated following a change in state. Gets the theme element details used to draw the control.

Called from the MeasureDraw method. The return value can be an enumeration value from either TThemedToolBar or TThemedButton depending on the value in the Flat property.

When Flat is True, one of the following TThemedToolBar values is returned:

ttbButtonDisabled
Used when IsEnabled is False.
ttbButtonChecked
Used when Down is True and the mouse pointer is not over the control.
ttbButtonCheckedHot
Used when Down is True and the mouse pointer is hovered over the control.
ttbButtonPressed
Used when Down is False and the mouse is hovered over a grouped button control.
ttbButtonHot
Used when Down is False and the mouse is hovered over a non-grouped button control.
ttbButtonNormal
Default state for the control.

When Flat is False, one of the following TThemedButton values is returned:

tbPushButtonDisabled
Used when IsEnabled is False.
tbPushButtonPressed
Used when a grouped button control is Down.
tbPushButtonHot
Used when a grouped button control is under the mouse pointer.
tbPushButtonNormal
Default state for the control.
Theme element detail used to draw the control in its current state. Returns True if the mouse pointer is in the display area for the control.

The property value is updated in the MouseEnter and MouseLeave methods when the mouse pointer enters or leaves the control area. The property value is used in the UpdateState method to determine if the button control is drawn using the "up" or "hot" states. It is used in the GetDrawDetails method to selected the theme element detail needed to draw the control in its current state.

Performs action when a new value is assigned to the Action property for the control.

ActionChange is overridden in TCustomSpeedButton to ensure that values from the new action instance in Sender are stored to properties in the control. ActionChange is the routine which implements the OnChange event handler for the ActionLink in the control. It is signalled (from TControl) when a new value is assigned to the Action property, or when the control is loaded using LCL component streaming.

Sender is the new action instance for the event, or Nil when the value in Action has been removed (set to Nil).

CheckDefaults indicates whether existing properties values in the control are used as default values. When set to False, the values from the action instance are applied to the control. Values from the action may be used (when assigned) if the properties in the control are unassigned - even when CheckDefaults is True.

ActionChange calls the inherited method to update property values like Caption, Enabled, Hint, Visible, HelpContext and HelpKeyword. When Sender is a TCustomAction instance, the values in GroupIndex, ImageIndex, and Images are also updated with the values from the action.

TControl.ActionChange
New action instance for the event. True to use existing properties as default values, False to use properties from the new action. Performs actions needed when LCL component streaming is completed for the control.

Loaded is called by the LCL streaming system when a root component was completely read from a stream and all properties and references to other objects have been resolved. Descendents of TComponent should override this method to perform additional processing when all published properties have been set from values obtained from the LCL component stream.

Application programmers should never call Loaded directly; this is done automatically by the LCL streaming system.

TComponent
Gets the size of the glyph within the specified PaintRect.

GetGlyphSize is a TSize function used to get the size of the glyph within the client rectangle specified in the PaintRect argument. The return value contains the Width (in CX) and the height (in CY). The member values are retrieved from a scaled image resolution for the glyph bitmaps in ButtonGlyph. The values are scaled to the client rectangle using the PixelsPerInch for the Font and the Canvas scaling factor for the control.

Use GetTextSize to get the Width and height or the Caption displayed on the control.

GetGlyphSize is used in the implementation of the MeasureDraw method.

TSize instance with the Width (CX) and height ( CY) for the glyph . True if the control is drawing, False if the control is measuring its components. Client rectangle for the control. Gets the size of the Caption text within the specified PaintRect.

GetTextSize is a TSize function used to get the dimensions for the Caption text for the control. It calculates the dimensions for the text using the TextStyle and Font assigned to the control Canvas.

The return value is a TSize instance where the CX and CY members represent the width and height for the text. The DrawText routine in the LCL interface is called to calculate the dimensions using the text style, flags, and the PaintRect for the control. The coordinates from the updated PaintRect are stored in CX and CY in the return value. Both members are set to 0 when ShowCaption is False or Caption contains an empty string ('').

GetTextSize is called from the MeasureDraw method.

TGraphicControl.Canvas TControl.Caption TControl.Font
TSize instance with the dimensions for the caption text. Not used in the current implementation. Display rectangle for the control; updated in the method with the calculated text dimensions. Draws the glyph image on the canvas at a given offset in the specified client rectangle.

Uses the internal TButtonGlyph instance for the control (when assigned) to access its Draw method. The PixelsPerInch setting in Font and the Canvas scaling factor for the control are used to scale the image.

The return value is a TRect instance with are needed to draw the glyph image on the specified canvas. Its member values are set to 0 (zero) when a TButtonGlyph instance has not been assigned by setting a Glyph bitmap for the control.

TRect instance used to draw the glyph bitmap. Canvas where the control is glyph is drawn. Client rectangle for the drawing operation. Offset into the client rectangle where the glyph is drawn. Button state drawn for the control. True if the glyph image is drawn with transparency. Not used in the current implementation. Create - constructor for TCustomSpeedButton: calls inherited Create and initializes many defaults and properties.

Create is the constructor for TCustomSpeedButton. It calls the inherited Create method and sets the default values for properties in the class instance. Among the properties set are Glyph, the initial bounds, control style, layout, color, caption and mouse responses.

TGraphicControl.Create
Owner of the class instance. Destroy - destructor for TCustomSpeedButton: frees Glyph then calls inherited Destroy. Destroy is the destructor for TCustomSpeedButton. It frees resources allocated to the Glyph property, and calls the inherited Destroy method. TGraphicControl.Destroy Gets the speed button with the same GroupIndex that has its Down property set.

FindDownButton locates a TCustomSpeedButton instance on the parent form which has the same GroupIndex and its Down property is set to True. FindDownButton visits each of the child controls on the parent form to find the speed buttons in the list of controls.

The return value contains the TCustomSpeedButton instance located. The return value is Nil if another speed button does not exist, is not in the same group, or is not Down.

No actions are performed in the method if the Down property in the current class instance is set, or when GroupIndex is 0 (zero). The return value is the current class instance in this circumstance.

TControl.Parent
The speed button in the group which is down. Loads the image for the Glyph with the specified name from a resource instance.

Calls the LoadGlyphFromLazarusResource routine in buttons.pas to load the bitmap for the specified resource name into the Glyph for the button control.

Modified in LCL version 4.0 to use the TLCLHandle type for the Instance argument instead of the deprecated THandle type. TLCLHandle
Handle for the resource with the specified glyph. Name of the glyph image resource loaded for the control. LoadGlyphFromLazarusResource - method for loading a glyph from a Lazarus Resource file (.lrs). Name of the glyph image loaded from the Lazarus resource. Horizontal alignment for the text displayed on the button control.

Alignment is a TAlignment property with the horizontal alignment for the Caption displayed on the button control. Alignment is used (along with UseRightToLeftReading) in the MeasureDraw method to set the text flags needed to measure / draw the Caption> for the control.

The default value for the property is taCenter, and causes the Caption to be centered in the text area on the control. Use taLeft to left-align the Caption in the text area. Use taRight to right-align the Caption for the control. Changing the value for the property causes the control to be redrawn.

Set the value in ShowCaption to True to display the Caption for the control.

Use the Layout property to control the placement of the image relative to the text value displayed on the control.

Use the Align property to specify the side on the parent control to which the speed button is aligned, or to specify that custom Anchors are used for positioning and sizing.

TControl.Align TControl.Anchors TControl.Caption TControl.UseRightToLeftReading TAlignment
Indicates if all buttons in a group can be in an up state.

AllowAllUp is a Boolean property which indicates whether all speed buttons with the same GroupIndex value can be in the "up" state. The default value for the property is False, and means that one of the grouped speed buttons must have its Down property set to True when GroupIndex has a non-zero value.

Changing the value for the property causes a button pressed event to be sent to the Parent control (when assigned) and the Down property is toggled and updated for the new property value.

Set GroupIndex to a value other than 0 (zero) to use AllowAllUp when a mouse button or an accelerator key is handled for the control.

TControl.Parent
The background color for the control.

The default value for the property is clBtnFace in TCustomSpeedButton.

If the color is clDefault, the result will need to be passed through GetDefaultColor to resolve clDefault to a TColor value. Convenience routines which obtain the color by resolving clDefault and ParentColor are also provided in the GetColorResolvingParent and GetRGBColorResolvingParent methods.

TControl.Color TControl.ParentColor TControl.GetDefaultColor TControl.GetColorResolvingParent TControl.GetRGBColorResolvingParent
Ordinal position for the image displayed when the control is disabled.

DisabledImageIndex is a TImageIndex property with the ordinal position for the bitmap displayed when Enabled is set to False. It indicates the position in Images or Glyph where the image data is stored. The default value for the property is -1, and indicates that an explicit value has not been assigned for the property.

The property value is read from and written to the image index members in ButtonGlyph.

The Lazarus IDE provides a property editor that allows selection of one of the Images from a drop-down image list. The position for the selected image is stored as the property value in the Object Inspector.

Added in LCL version 2.3.0. Available since version 3.0.
Indicates if the button has been set to the Down state.

Down is a Boolean property which indicates whether the button control is in the down (or pressed) state. The default value for the property is False. Changing the value for the property causes the control to be redrawn.

The value in Down is toggled in the DialogChar method when ShowAccelChar has been enabled and the accelerator key in Caption is received for the control. This also calls the Click method to execute the OnClick event handler or the action for the control.

Down is used in the UpdateState method, along with GroupIndex and MouseInControl, to determine the current TButtonState for the control.

Indicates whether the button is displayed with a Flat (non-relief) appearance.

Set Flat to True to draw the control without relief, elevation, or a three-dimensional appearance. The default value for the property is False. Changing the value for the property causes the control to be redrawn.

Flat is used in the GetDrawDetails method to select the theme element details applied to the control for its current state. When set to False, TThemedButton element details are used. When set to True, TThemedToolBar element details are used. See GetDrawDetails for more information about the values used for specific button states.

The bitmap with the glyph image(s) displayed for button states.

Glyph is a TBitmap property with the image drawn for the button control. Read and write access to the property value are redirected to an internal TButtonGlyph instance for the control. This allows a single image to be specified for Glyph, or multiple bitmaps for various button states using the Images property.

Changing the value for the property cause the control to be redrawn.

Identifies the group to which the speed button control belongs.

GroupIndex is used with AllowAllUp and Down to determine if the button state can be changed within the related group of controls. All buttons on the Parent control with the same value in GroupIndex are treated as a single group. The default value for the property is 0 (zero), and indicates that an explicit value has not been assigned for the property.

Set GroupIndex to a positive non-zero value to enable AllowAllUp checking when a mouse button event or an accelerator key is handled for the control.

Ordinal position for the glyph bitmap displayed when the mouse is hovered over the button control.

HotImageIndex is a TImageIndex property with the ordinal position for the bitmap displayed when the mouse cursor is hovered over the control. The default value for the property is -1, and indicates that an explicit value has not been assigned for the property.

The property value is read from and written to the image index members in ButtonGlyph.

The Lazarus IDE provides a property editor that allows selection of one of the Images from a drop-down image list. The position for the selected image is stored as the property value in the Object Inspector.

Added in LCL version 2.3.0. Available since version 3.0.
List of images available for use as state glyphs on the control.

Provides an alternate way to specify images (individually) as opposed to multiple adjacent bitmaps in Glyph.

Use ImageIndex to specify the ordinal position in Images for the glyph bitmap displayed on the control.

Use Glyph to access an image in the TButtonGlyph assigned to the control.

Ordinal position for the glyph bitmap displayed when the button is in its up state.

ImageIndex is a TImageIndex property with the ordinal position for the glyph bitmap displayed when the button is in its up state. The default value for the property is -1, and indicates that an explicit value has not been assigned for the property.

The property value is read from and written to the image index members in ButtonGlyph.

Added in LCL version 2.3.0. Available since version 3.0.
Width for the glyph bitmap displayed on the control.

ImageWidth is an Integer property with the Width in pixels for the TCustomImage instances stored in the Images property. The default value for the property is 0, and indicates that an explicit value has not been assigned for the property. This causes the Width property in the TCustomImageList to be used for an image retrieved from the list.

Changing the property value causes the external TButtonGlyph instance in the class to be updated with the new value. InvalidatePreferredSize is called to recalculate the preferred dimensions for the class instance. AdjustSize is called to auto-size the visible control and its parent.

Indicates the alignment of the glyph bitmap relative to the caption for the control.

Layout is a TButtonLayout property which indicates the position for the glyph on the speed button relative to the caption text for the control. The default value for the property is blGlyphLeft. It causes the Margin, Glyph (or image), Spacing, and Caption to be aligned to the left edge of the button surface.

Changing the property value causes the default size for the control to be recalculated (in SetLayout), and the control is redrawn.

Layout is used in the MeasureDraw method to position and size the text and glyph image for the button.

Use Margin to set the space reserved prior to the glyph bitmap on the aligned edge of the control. Use Spacing to set the space reserved between the Glyph image and the Caption relative to the aligned edge of the control.

TControl.Caption
Space between the glyph bitmap and the aligned edge in the button layout.

Margin is an Integer property with the space reserved between the Glyph image an the edge of the control. It is applied on the edge specified in Layout, and refers to a number of pixels. The value -1 has special meaning; it causes both the glyph and caption to be centered on the button surface.

Changing the value for the property causes the control to recalculate its preferred size, and the control is redrawn (in SetMargin).

Margin is used in the MeasureDraw method when the glyph image and caption text are positioned and sized on the control.

Use Layout to specify the edge on the button control to which the glyph bitmap and caption are aligned.

Use Spacing to set the space reserved between the glyph bitmap and the caption for the control.

In TCustomSpeedButton, any value assigned to BorderSpacing.InnerBorder is ignored.

TControl.Caption TControl.BorderSpacing TControlBorderSpacing.InnerBorder
The number of glyph bitmaps available for the control.

NumGlyphs is an Integer property which contains the number of glyph images available to the button control. Its value is read from and written to the NumGlyphs property in the internal TButtonGlyph instance used in the control.

The default value for the property is 1, and is set when a bitmap is assigned to the Glyph property or an image list is assigned to Images. Changing the value for the property causes the control to be redrawn.

Use Images to assign a user-specified list of images that can be used as the glyph for the button states. Use ImageIndex, PressedImageIndex, HotImageIndex, and DisabledImageIndex to specify which image is displayed on the control for the button states.

Ordinal position for the glyph bitmap displayed when the button is in a pressed (down) state.

PressedImageIndex is a TImageIndex property with the ordinal position for the glyph bitmap displayed when the Down property is True. The default value for the property is -1, and indicates that an explicit value has not been assigned for the property.

The property value is read from and written to the image index members in ButtonGlyph.

The Lazarus IDE provides a property editor that allows selection of one of the Images from a drop-down image list. The position for the selected image is stored as the property value in the Object Inspector.

Added in LCL version 2.3.0. Available since version 3.0.
Ordinal position for the glyph bitmap displayed when the button is selected.

SelectedImageIndex is a TImageIndex property. The default value for the property is -1, and indicates that an explicit value has not been assigned for the property.

Added in LCL version 2.3.0. Available since version 3.0.
Indicates if the accelerator key (shortcut) is displayed in the Caption for the control.

ShowAccelChar is a Boolean property which controls whether an accelerator key in Caption is displayed as an underlined character. The accelerator (or shortcut) key in Caption is identified by the '&' character, with the subsequent character used as the accelerator key.

When set to False, the underlined character is not drawn in Caption and the accelerator key is not handled in the DialogChar method.

The default value for ShowAccelChar is True. Changing the value for the property causes the control to be redrawn.

TControl.Caption
Indicates if the Caption for the speed button is displayed.

The default value for the property is True. Changing the value for the property causes the control to be redrawn.

ShowCaption is used in the MeasureDraw method. When set to True, the text extent for Caption is displayed using the Font and Layout for the control. It is also used in the GetTextSize method when the text extent is calculated.

Spacing between the Glyph bitmap and the Caption for the control.

If Spacing is -1 and Margin is -1 then the glyph and the Caption are centered, with the same amount of unused space on each side of the control. If Spacing is -1 and Margin is not -1 then Spacing will fill the remaining unused space.

Changing the value for the property causes the preferred size to be recalculated, and the control is redrawn (in SetSpacing).

TControl.Caption
Indicates if the control is drawn with transparency.

Transparent is a Boolean property which indicates whether the control is drawn with transparency. Changing the value for the property causes the ControlStyle property to be updated to include or exclude the csOpaque flag as needed, and the control is redrawn. The property value is read from and written to the TransparentMode property in ButtonGlyph.

The property value is passed as an argument to the DrawGlyph method when MeasureDraw is executed. When set to False, the PaintBackground method fills the display area with the background Color when theme element details have transparent areas.

A Button used to represent states (checked or unchecked).

The Speed Button is designed to automate a process when it is selected. An user pushes a button to start an action or set a mode.

When a user clicks on a SpeedButton focus is not shifted; a Speed Button never gets focus. The button may carry an descriptive glyph, and has a state (checked or not, etc).

How To Use Standard Controls
Indicates the bi-directional text mode for the control. String with the caption displayed for the control.

Gets caption as a text-string (GetText), or stores the new caption (SetText). Shows flag if caption is stored (IsCaptionStored).

By default, the Caption appears the same as the control Name in the Object Inspector, and the developer needs to set it explicitly to some new text.

The VCL implementation relies on the virtual Get/SetTextBuf to exchange text between widgets and VCL. This means a lot of (unnecessary) text copies.

The LCL uses strings for exchanging text (more efficient). To maintain VCL compatibility, the virtual RealGet/SetText is introduced. These functions interface with the LCLInterface.

The default Get/SetTextBuf implementation calls the RealGet/SetText. As long as the Get/SetTextBuf isn't overridden Get/SetText calls RealGet/SetText to avoid PChar copying.

To keep things optimal, LCL implementations should always override RealGet/SetText. Get/SetTextBuf is only kept for compatibility.

Modified in LCL version 3.0 to allow a multi-line value to be entered in the Object Inspector at design-time. TControl.Caption
Indicates if the control is visible on its parent.

The Visible property indicates whether a visual control is displayed. If Visible is True the control is shown, otherwise it is hidden. Calling Show sets Visible to True. Setting Visible to False is equivalent to calling the Hide method.

The Visible property does not use the visibility for the parent control. Use the IsVisible method to get the realized visibility.
TControl.Visible
TGetDefaultBitBtnGlyph - generic method to return a default Bit Button Glyph of specified Kind. Address of the routine used to get default glyphs for TBitBtn instances.

GetDefaultBitBtnGlyph is a TGetDefaultBitBtnGlyph variable with the address for the routine used to get the default glyphs for TBitBtn instances in the application.

Kind is a TBitBtnKind argument that identifies the content needed in the bitmap returned from the function.

Handled is a Boolean value which indicates if the TBitmap instance was successfully created and loaded in the routine.

Create a function using the signature in TGetDefaultBitBtnGlyph, and assign it the variable to use custom bitmaps for the glyphs in TBitBtn. For example:

// provides Ok and Cancel glyphs function GetCustomBitBtnGlyph(Kind: TBitBtnKind; Handled: Boolean): TBitmap; begin if Kind in [bkOK, bkCancel] then begin Result := TBitmap.Create; case Kind of bkOk: Result.Assign(MyOkGlyph); bkCancel: Result.Assign(MyCancelGlyph); end; end else Result := Nil; Handled := (Result <> Nil); end; // assign the routine to the GetDefaultBitBtnGlyph variable Buttons.GetDefaultBitBtnGlyph := @GetCustomBitBtnGlyph;
Gets the default LCL button glyph for the specified button Kind. TGraphic instance with the glyph loaded in the routine. Determines the default image loaded for the bitmapped button. Loads a bitmap from a named resource into the specified Glyph.

LoadGlyphFromResourceName is a procedure used to load a bitmap into the specified Glyph from a named resource. AGlyph is the TButtonGlyph where the bitmap is stored. Instance is a TLCLHandle for the resource instance accessed in the routine. AName contains the name for the resource loaded in the routine.

LoadGlyphFromResourceName calls CreateBitmapFromResourceName to retrieve a TCustomBitmap using the specified handle and resource name. The bitmap is assigned to the TButtonGlyph in AGlyph. When AName is an empty string (''), the Glyph image in AGlyph is set to Nil.

LoadGlyphFromResourceName is used in the implementation of the LoadGlyphFromResourceName method in both TCustomBitBtn and TCustomSpeedButton.

Modified in LCL version 4.0 to use the TLCLHandle type for the Instance argument instead of the deprecated THandle type. TLCLHandle
Button glyph updated in the routine. Handle for the resource. Resource name loaded in the routine. Loads the named glyph image from a Lazarus Resource file.

LoadGlyphFromLazarusResource loads a glyph image with the specified name from a Lazarus Resource file (.lrs). Used in the implementation of the LoadGlyphFromLazarusResource method in both TCustomBitBtn and TCustomSpeedButton.

Class instance where the bitmap for the glyph is stored. Resource name loaded in the routine. Loads the bitmap for the specified Glyph using the image for the specified button identifier.

LoadGlyphFromStock is a procedure used to load a TBitmap into the AGlyph argument with the image used for the button identifier in idButton. LoadGlyphFromStock calls the GetButtonIcon routine to load the graphic image for the button identifier.

Used in the implementation of the LoadGlyphFromStock method in both TCustomBitBtn.

TButtonGlyph where the bitmap is stored. Button identifier for the image loaded in the routine. Loads the image for the specified button glyph from the LCL glyph resource.

LoadGlyphFromResource is a routine used to load the LCL glyph image for the specified button identifier into the specified button glyph.

AGlyph is the TButtonGlyph instance where the glyph image is stored in the routine.

idButton contains one of the button identifier constants defined in the lcltype.pp unit, such as: idButtonOk, idButtonCancel, et. al. idButton must be in the range allowed for the TButtonImage type; no actions are performed in the routine if idButton is not within the required range.

LoadGlyphFromResource assigns the resource name in BitBtnResNames for the specified button identifier to the LCLGlyphName property in AGlyph. This causes the image with that name to be loaded from the LCLGlyphs image list.

TButtonGlyph instance where the glyph image is stored. Button identifier for the image resource loaded in the routine. Gets the default caption for the specified button identifier.

GetButtonCaption is a String function used to get the default caption for the numeric button identifier in idButton. The return value contains the resource string from the LCLStrConsts.pas unit for the value in idButton.

idButton contains one of the button identifiers defined in LCLType.pp, such as:

idButtonOk (1)
Returns the value in rsmbOK.
idButtonCancel (2)
Returns the value in rsmbCancel.
idButtonHelp (3)
Returns the value in rsmbHelp.
idButtonYes (4)
Returns the value in rsmbYes.
idButtonNo (5)
Returns the value in rsmbNo.
idButtonClose (6)
Returns the value in rsmbClose.
idButtonAbort (7)
Returns the value in rsmbAbort.
idButtonRetry (8)
Returns the value in rsmbRetry.
idButtonIgnore (9)
Returns the value in rsmbIgnore.
idButtonAll (10)
Returns the value in rsmbAll.
idButtonYesToAll (11)
Returns the value in rsmbYesToAll.
idButtonNoToAll (12)
Returns the value in rsmbNoToAll.
idButtonOpen (13)
Returns the value in rsmbOpen.
idButtonSave (14)
Returns the value in rsmbSave.
idButtonShield (15)
Returns the value in rsmbUnlock.

The return value is '?' if any other numeric value is passed in idButton.

GetButtonCaption is called when a value other than bkCustom is assigned to the Kind property in TCustomBitBtn.

Default caption for the specified button. Button identifier used to get the default caption from a resource string. Gets a scaled bitmap with the default glyph for the specified button identifier.

GetDefaultButtonIcon is a TCustomBitmap function used to retrieve the default glyph bitmap for the button identifier in idButton. idButton contains one of the button identifiers defined in LCLType.pp, such as:

  • idButtonOk (1)
  • idButtonCancel (2)
  • idButtonHelp (3)
  • idButtonYes (4)
  • idButtonNo (5)
  • idButtonClose (6)
  • idButtonAbort (7)
  • idButtonRetry (8)
  • idButtonIgnore (9)
  • idButtonAll (10)
  • idButtonYesToAll (11)
  • idButtonNoToAll (12)
  • idButtonOpen (13)
  • idButtonSave (14)
  • idButtonShield (15)

GetDefaultButtonIcon uses the value in idButton to get the resource name for the button from the BitBtnResNames constant. If a resource name is not found for the button identifier, the image data in the return value is empty.

ScalePercent contains the scaling percentage for the retrieved bitmap. The default value is 100 and keeps the original dimensions for the bitmap.

GetDefaultButtonIcon calls the GetDefaultGlyph routine to retrieve the scaled bitmap. The image is loaded from application or LCL resources with the required name and scaling percentage, and stored in the return value. Transparency is applied to the bitmap using the color in the bottom, left pixel if it is not already enabled. Please note that GetDefaultGlyph raises an exception if a resource with the required name and scaling percentage is not found in the available resources.

GetDefaultButtonIcon is called from the GetButtonIcon and GetLCLDefaultBtnGlyph routines, and occurs when a value other than bkCustom is assigned to the Kind property in TCustomBitBtn.

GetDefaultGlyph
Default glyph bitmap for the specified button identifier. Numeric button identifier used to retrieve the glyph from LCL resources. Scaling percentage for the glyph bitmap. The default value is 100. Gets a bitmap with the glyph image for the specified button identifier.

GetButtonIcon is a TCustomBitmap function used to get a bitmap with the glyph for the button identifier in idButton. GetButtonIcon calls the GetStockImage routine in ThemeServices to get the handle used for the stock image. If the return value is False, the GetDefaultButtonIcon routine is called to get the icon for the button identifier.

GetButtonIcon is used in the implementation of the LoadGlyphFromStock routine.

Bitmap instance with the glyph for the specified button. Numeric button identifier for the glyph loaded in the routine. Gets the ordinal position in the LCL Glyph image list for the specified button identifier.

GetButtonImageIndex is an Integer function used to retrieve the position for the specified button identifier in the LCL glyph image list.

idButton is the TButtonImage value for the button identifier requested in the routine. It is used to identify the resource name in BitBtnResNames for the button glyph. The resource name is located in the LCLGlyphs image list using its GetImageIndex method.

The return value contains the ordinal position in LCLGlyphs where the corresponding resource name is stored, or -1 if the resource name is not found.

TLCLGlyphs.GetImageIndex LCLGlyphs
Ordinal position for the specified button identifier, or -1 when not found. Button identifier constant for the image requested in the routine. Adjusts the specified button layout for use in bi-directional rendering.

Adjusts the layout for button glyphs to reflect the settings in IsRightToLeft. Uses an implementation constant to get the TButtonLayout value needed for the setting in IsRightLeft.

In general, when IsRightToLeft is True the value in Layout is reversed and used as the return value. blGlyphLeft becomes blGlyphRight, blGlyphTop becomes blGlyphBottom, etc.

When IsRightToLeft is False, the value in Layout is used.

Adjusted glyph layout needed for the value in IsRightToLeft. True when BiDiMode has any value other than bdLeftToRight. Glyph layout needed for the button using the specified BiDi setting. Gets a String with debugging information from the specified TBitBtnKind instance. Formatted string value with the information for the type. TBitBtnKind instance examined in the routine. Contains modal result values for buttons defined in TBitBtnKind.

BitBtnModalResults is an Array constant which contains TModalResult values returned for buttons in TBitBtn. BitBtnModalResults is indexed by the enumeration values in TBitBtnKind. BitBtnModalResults is used in the implementation of the RealizeKind method in TCustomBitBtn.

Contains button identifiers used to get icons for TBitBtn button glyphs.

BitBtnImages is an Array constant which contains LongInt values for the button identifiers used in TBitBtn. BitBtnImages is indexed by the enumeration values in TBitBtnKind. Values in BitBtnImages are used in the GetLCLDefaultBtnGlyph routine.

Contains resource names for corresponding button identifiers in TBitBtn.

BitBtnResNames is an Array constant that contains Strings with the resource name for button identifiers used in TBitBtn. Values in BitBtnResNames are indexed by the range of values defined in BitBtnImages: idButtonOk..idButtonNoToAll.

BitBtnResNames is used in the implementation of the RealizeKind method in TCustomBitBtn.

Registers components for use in the Lazarus IDE.

Register is the procedure used to register components for use in the Lazarus IDE. The following components are added to the Lazarus IDE component palette:

Additional Tab

  • TBitBtn
  • TSpeedButton