TCoreButton

Base button component with theme support. Implements IThemeSubscriber for automatic theme updates.

UI ComponentIThemeSubscriber

Overview

TCoreButton extends TWebButton with theme integration and CSS class support. All buttons in the Framework should inherit from TCoreButton.

Published Properties

PropertyTypeDescription
CaptionSTRINGButton text.
EnabledBooleanWhether button is clickable.
ElementClassNameSTRINGCSS class(es) to apply.

IThemeSubscriber

TCoreButton implements IThemeSubscriber. Override ApplyThemeStyles to customize theme application:

PROCEDURE TCoreButton.ApplyThemeStyles(ThemeManager: TThemeManager);
VAR
   ButtonStyle: TComponentStyleDef;
BEGIN
   ButtonStyle := ThemeManager.GetStyleDef('button');
   IF Assigned(ButtonStyle) THEN
      BEGIN
         TDom.SetStyle(ElementHandle, 'background-color', ButtonStyle.BackgroundColor);
         TDom.SetStyle(ElementHandle, 'color', ButtonStyle.TextColor);
      END;
END;

FUNCTION TCoreButton.GetSubscriberComponentType: STRING;
BEGIN
   Result := 'button';
END;