Defines a panel with Bitmap buttons Enumerated type with the display order used for buttons on TButtonPanel TButtonOrder is an enumeration with values which indicate the display order used for buttons on TButtonPanel. Uses the default button order; OK, Cancel, Close, Help Use the button order Close, Cancel, OK Use the button order Close, OK, Cancel Enumeration with values that represent the button types used on TButtonPanel TPanelButton is an enumeration type with values which represent the button types used on TButtonPanel. Represents the OK button on the panel Represents the Cancel button on the panel Represents the Close button on the panel Represents the Help button on the panel Set type used to store TPanelButton values

TPanelButtons is a set type used to store enumeration values from TPanelButton. TPanelButtons is the type used to implement the ShowButtons and ShowGlyphs properties in TButtonPanel.

Implements the buttons displayed for TButtonPanel

TPanelBitBtn is a TCustomBitBtn descendant used to implement the buttons displayed for TButtonPanel. TPanelBitBtn is the type used to implement the OKButton, HelpButton, CloseButton, and CancelButton properties in TButtonPanel.

TPanelBitBtn includes an overridden constructor to mark its use as a sub-component. It also sets the visibility, storage specifiers, and default values for properties inherited from ancestors classes.

Constructor for the class instance

Create is the overridden constuctor for the class instance. Create calls the inherited method, and calls SetSubComponent to indicate that the component is used as a sub-component in the parent control.

Owner for the class instance Indicates if the Caption for the button contains a default value

DefaultCaption determines if the value in Caption is included in the LCL component streaming mechanism; Caption is stored for the component when DefaultCaption is False.

Contains the Left pixel coordinate for the button

Left is not a stored property value in the LCL component streaming mechanism. Its value it always calculated the button position relative to the parent control for the component.

Contains the Top pixel coordinate for the button

Top is not a stored property value in the LCL component streaming mechanism. Its value it always calculated the button position relative to the parent control for the component.

Contains the Width in pixels for the button

Width is not a stored property value in the LCL component streaming mechanism. Its value it always calculated the button position relative to the parent control for the component.

Contains the Height in pixels for the button

Height is not a stored property value in the LCL component streaming mechanism. Its value it always calculated the button position relative to the parent control for the component.

Name or identifier assigned for the button

Name is a String property with the identifier assigned to the button to indicates its usage in TButtonPanel. Name contains a constant value like 'OKButton', 'CancelButton', 'CloseButton', or 'HelpButton'. The value in Name is assigned when the button is created in the CreateButton method in TCustomButtonPanel.

Popup menu displayed when the button is pressed or clicked Indicates if the Hint is displayed when the control has mouse or keyboard focus Defines the base class for TButtonPanel

TCustomButtonPanel is a TCustomPanel descendant which defines the base class for TButtonPanel, a panel containing Bitmap buttons. Buttons are provided for OK, Help, Close, and Cancel operations. Other properties are provided to control the display order for the buttons, the default button for the panel, visibility of the available buttons, and the use of glyphs.

Applications should not create instances of TCustomButtonPanel; use the TButtonPanel ancestor which specifies the visibility of properties (including event handlers).

Creates and configures a Bitmap button for the specified button type

CreateButton creates and stores the TPanelBitBtn instance used for the button type in AButton. AButton is a TPanelButton enumeration value.

Create sets values in the Name, Kind, AutoSize, TabOrder, Align, and Default properties in the button instance. The Bitmap for the button Glyph is created or re-assigned as necessary.

Please note: No actions are performed in the method if the button type in AButton has already been created for the panel.

CreateButton is used in the implementation of the DoShowButtons method.

TPanelButton value which identifies the button created in the method Updates the buttons on the panel to match the DefaultButton property

DoDefaultButton is a procedure used to update the buttons on the panel to identify the default button. Values from the TPanelButton enumeration are used to access the buttons present on the panel. The Default property in each button is updated to indicate if the button instance is the value stored in the DefaultButton property.

No actions are performed in the method when ShowButtons contains an empty set ([]).
Performs actions needed to create and/or configure buttons displayed on the panel

DoShowButtons is a procedure used to perform actions needed to create and/or configure buttons displayed on the panel. DoShowButtons iterates over the buttons defines for the panel. If the button has not already been created, the CreateButton method is called to initialize and store the button instance. The ShowButtons property is used to determine if the button is displayed at run-time and design-time.

DoShowButtons calls UpdateButtonOrder to display the buttons in the order specified in the ButtonOrder property. UpdateButtonLayout is called to ensure that the buttons use custom alignment, and to set the default button for the layout.

Please note: Autosizing for the panel control is disabled prior to updating the button layout, and restored prior to exiting from the method.

DoShowButtons is called when a value is assigned to the ShowButtons property.

Assigns the bitmaps used as glyphs for the buttons on the panel

DoShowGlyphs is a procedure used to assign the bitmaps used as glyphs for the buttons on the panel. DoShowGlyphs iterates over the buttons displayed on the panel, and uses the values in the ShowGlyphs property to set or reset the glyph used in the button instance.

Please note: Autosizing for the panel control is disabled prior to updating the button glyphs, and restored prior to exiting from the method.

DoShowGlyph is called when a value is assigned to the ShowGlyphs property.

Sets the value for the ButtonOrder property

Calls UpdateButtonOrder to refresh the display order for buttons on the panel.

New value for the property Sets the value for the DefaultButton property

Calls the DoDefaultButton method.

New value for the property Sets the value for the ShowBevel property

Calls the UpdateBevel method.

New value for the property Sets the value for the ShowButtons property

Calls the InvalidatePreferredSize and DoShowButtons methods.

New value for the property Sets the value for the ShowGlyphs property

Calls the InvalidatePreferredSize and DoShowGlyphs methods.

New value for the property Sets the value for the Spacing property

Calls the InvalidatePreferredSize and ReAlign methods.

New value for the property Configures the shape and alignment for the bevel displayed on the panel

UpdateBevel is a procedure used to set the shape and alignment for the bevel displayed on the panel. It sets the values in the Align and Shape properties for the TBevel instance based on the content in the Align property for the panel. For instance:

Panel Align Bevel Align Bevel Shape
alTop alBottom bsBottomLine
alLeft alRight bsRightLine
alRight alLeft bsLeftLine
alBottom alTop bsTopLine

The width for the bevel is set to 2 for horizontal panel alignments (left or right). Otherwise, the height for the bevel is set to 2 for vertical panel alignments (top or bottom).

UpdateBevel is called when a value is assigned to the ShowBevel property.

Please note: No actions are performed in the method when ShowBevel contains False.
Sets the Tab order for visible buttons on the panel

UpdateButtonOrder is a procedure used to set the tab order for visible buttons on the panel. It sets the TabOrder property in each of the TPanelBitBtn instances using the ButtonOrder for the panel.

UpdateButtonOrder calls the AdjustSize method to resize the panel and its controls.

Use ShowButtons to specify the visible buttons on the panel. Use ButtonOrder to define the display and tab order for the buttons.

Calculates the size for button controls displayed on the panel

UpdateSizes is a procedure used to calculate the size for button controls displayed on the panel. UpdateSizes gets the button size using GetElementDetails in ThemeServices, and stores the values in the internal members used in the panel class.

All button controls on the panel are updated. GetPreferredSize is called using the expected button Height and Width. The Align property is also updated when adjusting the button Height and Width.

UpdateSizes is called when a value is assigned to the Align property, and from the Notification method.

Please note: No actions are performed in the method at design-time.
Updates the alignment for visible buttons on the panel

UpdateButtonLayout is a procedure used to update the alignment for the visible buttons on the panel. UpdateButtonLayout uses the enumeration values from ShowButtons to determine the button instances updated in the method.

The Align property in each of the TPanelBitBtn instances on the panel is set to the value alCustom. In addition, the Default property in the button instance is updated to True when it contains the same class instance as the value stored in the DefaultButton property.

UpdateButtonLayout is called when a value is assigned to the Align property, and from the DoShowButtons method.

Applies button sizes using theming and scaling ??? Indicates if the specified button is the last one defined in the button order for the panel True when the specified button is the last in the button order Control compared to the buttons on the panel ??? Sets the value for the Align property Calls the UpdateButtonLayout, UpdateBevel, and UpdateSizes methods. New value for the property Performs the control message needed when the visibility for a button glpyh has changed Control message passed in the method Performs the Lazarus control message when a button visibility is changed Control message passed in the method Constructor for the class instance

Create is the overridden constructor for the class instance. Create calls the inherited constructor, and sets the default values for properties in the panel to the following:

Align
alBottom
BevelInner
bvNone
BevelOuter
bvNone
Caption
Set to an empty string ('')
AutoSize
True
Spacing
6
ShowBevel
True
DefaultButton
pbOK
ButtonOrder
boDefault
ShowButtons
DefShowButtons
ShowGlyphs
DefShowGlyphs

The ControlStyle property is modified in the method to add the csOwnedChildrenNotSelectable style, and to remove the csSetCaption style.

Create calls the DoShowButtons method to create and configure the TPanelBitBtn instances used in the panel class.

Owner for the class instance Destructor for the class instance

Destroy is the overridden destructor for the class instance. Destroy ensures that TBitmap instances created for button glyphs in the panel are freed. Destroy calls the inherited destructor prior to exiting from the method.

Indicates the alignment used for the panel relative to the owner for the panel

Align is a public property in TCustomButtonPanel used to specify the border (or edge) where the panel (and its buttons and bevel) are aligned. The default value for the property is alBottom. Changing the value in Align causes the UpdateButtonLayout, UpdateBevel, and UpdateSizes methods to be called.

Indicates if the panel can automatically adjust its size OKButton - a button with the caption 'OK' signifying acceptance by the user HelpButton - a button with the 'Help' caption, for requesting help CloseButton - a button with the 'Close' caption for terminating the Form or panel CancelButton - a button with the 'Cancel' caption for cancelling the operation ButtonOrder - the order in which the series of buttons will appear on the panel The default button executed when pressing Enter or Return

DefaultButton contains the button used as the default action performed when the Return or Enter key is pressed.

Indicates if buttons are displayed on the panel

ShowButtons is a Boolean property which Indicates if buttons are displayed on the panel.

Indicates whether Glyphs (small images) are shown on the buttons for the panel

ShowGlyphs is a Boolean property which indicates whether Glyphs (small images) are shown on the buttons for the panel.

Indicates if a bevel is displayed for the button panel

ShowBevel is a Boolean property which indicates if a TBevel is displayed on the edge opposite of the alignment for the panel. Changing the value for the property causes a TBevel instance to be created (or freed), and the UpdateBevel method to be called.

Contains the spacing around buttons and bevels on the panel

Spacing is a TSpacingSize property which indicates the number of pixels reserved between buttons and bezels displayed on the panel. The default value for the property is 6. Changing the value in Spacing causes the InvalidatePreferredSize and ReAlign methods to be called.

Use BorderSpacing to indicate the space reserved on the borders (or edges) for the panel.

Implements a panel with Bitmap Button instances

TButtonPanel is a TCustomButtonPanel descendant which implements a panel containing Bitmap buttons. Buttons are provided for OK, Help, Close, and Cancel operations. Other properties are provided to control the display order for the buttons, the default button for the panel, visibility of the available buttons, and the use of glyphs.

Registers the TButtonPanel class in the Lazarus IDE

Register is a procedure used to register the TButtonPanel component on the Misc tab in the Lazarus IDE.