TW3Button



TW3Button

 

TW3ButtonRepresents class for Button control. W3Button component react on user clicks (taps) and change state.


TW3Button-test.png

Unit: SmartCL.Controls.Button.pas

Hierarchy
TObject
TW3TagObj
TW3Component
TW3MovableControl
TW3CustomControl
TW3Button
Properties
Property-icon.png Caption
Property-icon.png Pressed

Properties

 

Property-icon.png Caption

Specifies Buttons title.

property Caption : String read GetCaption write SetCaption;
 

Property-icon.png Pressed

Determine whether button is in pressed state. In pressed state, different CSS class is assigned to the button object (TW3Button_Pressed).

property Pressed : Boolean read FPressed;

W3Button usage:

W3Button usually implements OnClick event (introduced in TW3CustomControl class). It is required to reference this property to your event handler. This may be done in design-time by setting value beside OnClick event (double-click on event to create handler) in Object Inspector, or via code:

type
  TForm1 = class(TW3form)
  private
    { Private methods }
    {$I 'Form1:intf'}
  protected { Protected methods } procedure InitializeObject; override;
    procedure FinalizeObject; override;
    procedure DoButton1Click(Sender: TObject);
  end;
  
  implementation
  
procedure TForm1.InitializeObject;
begin
  inherited;
  {$I 'Form1:impl'} // We need to set reference to event handler  
  W3Button1.OnClick := DoButton1Click;
end;// Our event handlerprocedure 

TForm1.DoButton1Click(Sender: TObject);
begin  
  MyLabel.Caption := 'Button clicked!';
end;