Sign in Join
FPDoc Onlineexperiment

GetDefaultButtonIcon function

In unit Buttons

Gets a scaled bitmap with the default glyph for the specified button identifier.

Declaration

pascal
function GetDefaultButtonIcon(idButton: Integer; 
 ScalePercent: Integer=100): TCustomBitmap

Description

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.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.