TW3Button
TW3ButtonRepresents class for Button control. W3Button component react on user clicks (taps) and change state.
Unit: SmartCL.Controls.Button.pas
- Hierarchy
- TObject
| Properties |
|---|
| |
| |
Properties
Caption
Specifies Buttons title.
property Caption : String read GetCaption write SetCaption;
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;