From Clomosy Docs

No edit summary
No edit summary
Line 2: Line 2:
If we have code that we want to run every second, we write it to the tbeOnTimer event of the TClTimer component. Then, if we set the component's Interval property to 1000, the code we wrote will be executed every second.<br>
If we have code that we want to run every second, we write it to the tbeOnTimer event of the TClTimer component. Then, if we set the component's Interval property to 1000, the code we wrote will be executed every second.<br>


  AddNewTimer(TComponent, xName, xMillisecond): TClTimer
  AddNewTimer(xOwner:TComponent; xName:String; xInterval:Integer): TClTimer


<span style="color:blue"> TComponent</span> : The variable name of the defined component is written. Here you should write the component variable name of whatever your component will be in.
<span style="color:blue"> TComponent</span> : The variable name of the defined component is written. Here you should write the component variable name of whatever your component will be in.
Line 10: Line 10:
<span style="color:blue"> xMillisecond</span> : Type the trigger time of the time in milliseconds. If we write the time as 0 here, the trigger will not occur at all.
<span style="color:blue"> xMillisecond</span> : Type the trigger time of the time in milliseconds. If we write the time as 0 here, the trigger will not occur at all.


Let's create a TclTimer.<br>
{| class="wikitable" style="border: 2px solid #c3d7e0"
1. Create a new project.<br>
! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"|Definition
|-
|TClTimer || Timer1: TclTimer; || A variable belonging to the TclTimer class is created.
|-
|AddNewTimer || Timer1 = MyForm.AddNewTimer(MyForm,'Timer1',1000); // the action is triggered every 1 second. || A new TclTimer is added to the form.
|-
|tbeOnTimer ||MyForm.AddNewEvent(Timer1,tbeOnTimer,'timerShow'); || If we want to activate the click event of our TCLTimer component, it is done using AddNewEvent. Here, tbeOnTimer is written as the second parameter. In the last parameter, the action to be triggered on click is specified.
|-
|Interval ||Timer1.Interval = 1000; || When creating an object, the time interval to be triggered is specified in the third parameter of the AddNewTimer function. If we set the time to 0 here, the trigger will never occur. In this case, a trigger time can be assigned to the Interval property to enable the triggering. Thus, even if it's set to 0, the triggering will still occur with the interval.<br>
This property specifies the intervals at which the timer component will operate. If the interval is set to 1000, the timer will run every second, meaning 1000 represents 1 second. If the interval value is 500, the timer will run twice per second.
|-
|Enabled || Timer1.Enabled = True; //or False || It is the property that determines whether the TClTimer component will run or not. If the Enabled property is set to true, the timer executes its code at the specified intervals. If the Enabled property is set to false, the timer does not run.
|}


2. You need to define TclTimer on the form. To do this, you should add under the var parameter on the ide as follows. It is the name of your variable you typed at the beginning. You should define this as you want and add it as TclTimer.<br>
'''Example:'''<br>
In the example, the chromometer was built using a timer. You can use it this way or you can use this component for any scheduling you want.<br>


'''var'''
:'''TRObject Syntax'''
GetTimer: TClTimer;
<pre>
var
  MyForm:TclForm;
  GetTimer: TClTimer;
  GetStartTimerBtn,GetStopTimerBtn : TClProButton;
  duration, sn ,ss : Integer;
  lblTimer : TclLabel;
  lytTimer :TClLayout;
  pnlTimer :TClPanel;


3. Add the TClTimer to the form. For this, you must add the begin end block and add it inside the form after the form is defined. By saying MyForm.AddNewTimer, we actually add to the form we have defined. Here, you need to add your form definition as whatever you wrote it.
void BtnStartClick;
GetTimer:= MyForm.'''AddNewTimer'''(MyForm,'GetTimer',1000); // the action is triggered every 1 second.
{
  //GetTimer.Interval = 100; //You can enable it if you don't use a time trigger when calling AddNewTimer.
  GetTimer.Enabled = True;
  MyForm.AddNewEvent(GetTimer,tbeOnTimer,'timerShow');
}


4. While defining the component, you can define it manually by typing. Another method is to write its shortcut. If you type "AddNewTimer" while the shortcut is in the code block, a pop-up menu will appear.<br>
void BtnStopClick;
{
  GetTimer.Enabled = False;
}


[[File:TclTimerShortcut.png|frameles|400px]]<br><br>
void timerShow;
{
  Inc(duration);
  sn = (duration div 10);
  ss = (duration mod 10);
  lblTimer.Caption = IntToStr(sn)+'.'+IntToStr(ss);
}


As soon as you click, the following block will come automatically.<br>
{
AddNewTimer(xOwner:TComponent; xName:String; xInterval:Integer);
  duration = 0;
  MyForm = TclForm.Create(Self);
  GetTimer= MyForm.AddNewTimer(MyForm,'GetTimer',100);
 
  pnlTimer=MyForm.AddNewPanel(MyForm,'pnlTimer');
  pnlTimer.Align=AlCenter;
  pnlTimer.Height=150;
  pnlTimer.Width=300;
 
  lytTimer = MyForm.AddNewLayout(pnlTimer,'lytTimer');
  lytTimer.Align=ALTop;
  lytTimer.Height = 70;
  lytTimer.Width = 300;
 
  GetStartTimerBtn = MyForm.AddNewProButton(lytTimer,'GetStartTimerBtn','Start');
  GetStartTimerBtn.Align = alLeft;
  GetStartTimerBtn.Width = 100;
  GetStartTimerBtn.Height = 40;
  GetStartTimerBtn.clProSettings.BorderColor = clAlphaColor.clHexToColor('#7A3E65');
  GetStartTimerBtn.clProSettings.RoundHeight = 2;
  GetStartTimerBtn.clProSettings.RoundWidth = 2;
  GetStartTimerBtn.clProSettings.BorderWidth = 3;
  GetStartTimerBtn.clProSettings.IsRound = True;
  GetStartTimerBtn.SetclProSettings(GetStartTimerBtn.clProSettings);
  MyForm.AddNewEvent(GetStartTimerBtn,tbeOnClick,'BtnStartClick');
 
 
  GetStopTimerBtn = MyForm.AddNewProButton(lytTimer,'GetStopTimerBtn','Stop');
  GetStopTimerBtn.Align = alRight;
  GetStopTimerBtn.Width = 100;
  GetStopTimerBtn.Height = 40;
  GetStopTimerBtn.SetclProSettings(GetStartTimerBtn.clProSettings);
  MyForm.AddNewEvent(GetStopTimerBtn,tbeOnClick,'BtnStopClick');
 
 
  lblTimer= MyForm.AddNewLabel(pnlTimer,'lblTimer','0.0');
  lblTimer.StyledSettings = ssFamily;
  lblTimer.TextSettings.Font.Size=25;
  lblTimer.Align = alBottom;
  lblTimer.Margins.Left= 130;
  lblTimer.Height = 50;
  lblTimer.Width = 200;
 
  MyForm.Run;
}
</pre>


5. We gave the variable name while defining the TClTimer in var. Now when you add this in begin end you should use this variable name in all definitions. Your code will throw an error when you write these variable names incorrectly.
:'''Base Syntax'''
 
<pre>
6. Now, if we want to activate the click feature of our TCLTimer component, we can do it with AddNewEvent. Here we should write tbeOnTimer as the 2nd parameter. In the last parameter, we should write the action that will be triggered when clicked.<br>
var
 
  MyForm:TclForm;
MyForm.AddNewEvent(GetTimer,'''tbeOnTimer''','timerShow');
  GetTimer: TClTimer;
 
  GetStartTimerBtn,GetStopTimerBtn : TClProButton;
7. Below, the time to be triggered is written in the 3rd parameter at the time of calling with the AddNewTimer function. If we write the time as 0 here, the trigger will not occur at all. In this case, a trigger time can be given to the Interval property for triggering. Thus, even though it is 0, triggering with interval will still be provided.<br>
  duration, sn ,ss : Integer;
 
  lblTimer : TclLabel;
'''Interval Property:''' This property specifies the intervals at which the timer component will be run. If the Interval is set to 1000, the timer will run every second. So 1000 means 1 second. If the Interval value is 500, the timer will run 2 times per second.<br>
  lytTimer :TClLayout;
  pnlTimer :TClPanel;


The following code show how to define the interval property of the timer component.<br>
Procedure BtnStartClick;
begin
  //GetTimer.Interval := 100; //You can enable it if you don't use a time trigger when calling AddNewTimer.
  GetTimer.Enabled := True;
  MyForm.AddNewEvent(GetTimer,tbeOnTimer,'timerShow');
End;


VariableValue.Interval := 1000;
procedure BtnStopClick;
begin
  GetTimer.Enabled := False;
end;


8. '''Enabled Property:''' It is the property that the TClTimer component decides whether to run the codes or not. If the enabled property is true, the timer runs the codes at the desired times. If the Enabled property is false, the timer will not work.<br>
procedure timerShow;
begin
  Inc(duration);
  sn := (duration div 10);
  ss := (duration mod 10);
  lblTimer.Caption := IntToStr(sn)+'.'+IntToStr(ss);
end;


In the codes below, the enabled property of the timer component is changed to true and false.<br>
begin
 
  duration := 0;
VariableValue.Enabled := True;
  MyForm := TclForm.Create(Self);
VariableValue.Enabled := False;
  GetTimer:= MyForm.AddNewTimer(MyForm,'GetTimer',100);  
 
 
9. To tell you the truth, you have created a simple application that does nothing yet. Let's save and start using our project. You can save in one of two ways:<br>
Click the save icon (the button in the upper right corner) or press Ctrl + S to save the project and see what you've done on the platforms now.
 
'''Example:'''<br>
In the example, the chromometer was built using a timer. You can use it this way or you can use this component for any scheduling you want.<br>
:'''Base Syntax'''
  var
    MyForm:TclForm;
    GetTimer: TClTimer;
    GetStartTimerBtn,GetStopTimerBtn : TClProButton;
    duration, sn ,ss : Integer;
    lblTimer : TclLabel;
    lytTimer :TClLayout;
    pnlTimer :TClPanel;
    
    
   Procedure BtnStartClick;
   pnlTimer:=MyForm.AddNewPanel(MyForm,'pnlTimer');
   begin
   pnlTimer.Align:=AlCenter;
    //GetTimer.Interval := 100; //You can enable it if you don't use a time trigger when calling AddNewTimer.
  pnlTimer.Height:=150;
    GetTimer.Enabled := True;
  pnlTimer.Width:=300;
    MyForm.AddNewEvent(GetTimer,tbeOnTimer,'timerShow');
  End;
    
    
   procedure BtnStopClick;
   lytTimer := MyForm.AddNewLayout(pnlTimer,'lytTimer');
   begin
   lytTimer.Align:=ALTop;
    GetTimer.Enabled := False;
  lytTimer.Height := 70;
   end;
   lytTimer.Width := 300;
    
    
   procedure timerShow;
   GetStartTimerBtn := MyForm.AddNewProButton(lytTimer,'GetStartTimerBtn','Start');
   begin
   GetStartTimerBtn.Align := alLeft;
    Inc(duration);
  GetStartTimerBtn.Width := 100;
    sn := (duration div 10);
  GetStartTimerBtn.Height := 40;
    ss := (duration mod 10);
  GetStartTimerBtn.clProSettings.BorderColor := clAlphaColor.clHexToColor('#7A3E65');
    lblTimer.Caption := IntToStr(sn)+'.'+IntToStr(ss);
  GetStartTimerBtn.clProSettings.RoundHeight := 2;
   end;
  GetStartTimerBtn.clProSettings.RoundWidth := 2;
  GetStartTimerBtn.clProSettings.BorderWidth := 3;
  GetStartTimerBtn.clProSettings.IsRound := True;
  GetStartTimerBtn.SetclProSettings(GetStartTimerBtn.clProSettings);
   MyForm.AddNewEvent(GetStartTimerBtn,tbeOnClick,'BtnStartClick');
    
    
  begin
    duration := 0;
    MyForm := TclForm.Create(Self);
    GetTimer:= MyForm.AddNewTimer(MyForm,'GetTimer',100);
   
    pnlTimer:=MyForm.AddNewPanel(MyForm,'pnlTimer');
    pnlTimer.Align:=AlCenter;
    pnlTimer.Height:=150;
    pnlTimer.Width:=300;
   
    lytTimer := MyForm.AddNewLayout(pnlTimer,'lytTimer');
    lytTimer.Align:=ALTop;
    lytTimer.Height := 70;
    lytTimer.Width := 300;
   
    GetStartTimerBtn := MyForm.AddNewProButton(lytTimer,'GetStartTimerBtn','Start');
    clComponent.SetupComponent(GetStartTimerBtn,'{"Align" : "Left",
    "Width" :100,"Height":40,"RoundHeight":2, "RoundWidth":2,"BorderColor":"#7A3E65","BorderWidth":2}');
    MyForm.AddNewEvent(GetStartTimerBtn,tbeOnClick,'BtnStartClick');
   
    GetStopTimerBtn := MyForm.AddNewProButton(lytTimer,'GetStopTimerBtn','Stop');
    clComponent.SetupComponent(GetStopTimerBtn,'{"Align" : "Right",
    "Width" :100,"Height":40,"RoundHeight":2, "RoundWidth":2,"BorderColor":"#7A3E65","BorderWidth":2}');
    MyForm.AddNewEvent(GetStopTimerBtn,tbeOnClick,'BtnStopClick');
   
    lblTimer:= MyForm.AddNewLabel(pnlTimer,'lblTimer','0.0');
    lblTimer.StyledSettings := ssFamily;
    lblTimer.TextSettings.Font.Size:=25;
    lblTimer.Align := alBottom;
    lblTimer.Margins.Left:= 130;
    lblTimer.Height := 50;
    lblTimer.Width := 200;
   
    MyForm.Run;
  end;
:'''TRObject Syntax'''
  var
    MyForm:TclForm;
    GetTimer: TClTimer;
    GetStartTimerBtn,GetStopTimerBtn : TClProButton;
    duration, sn ,ss : Integer;
    lblTimer : TclLabel;
    lytTimer :TClLayout;
    pnlTimer :TClPanel;
    
    
   void BtnStartClick;
   GetStopTimerBtn := MyForm.AddNewProButton(lytTimer,'GetStopTimerBtn','Stop');
   {
   GetStopTimerBtn.Align := alRight;
    //GetTimer.Interval = 100; //You can enable it if you don't use a time trigger when calling AddNewTimer.
  GetStopTimerBtn.Width := 100;
    GetTimer.Enabled = True;
  GetStopTimerBtn.Height := 40;
    MyForm.AddNewEvent(GetTimer,tbeOnTimer,'timerShow');
  GetStopTimerBtn.SetclProSettings(GetStartTimerBtn.clProSettings);
  }
  MyForm.AddNewEvent(GetStopTimerBtn,tbeOnClick,'BtnStopClick');
    
    
  void BtnStopClick;
  {
    GetTimer.Enabled = False;
  }
    
    
   void timerShow;
   lblTimer:= MyForm.AddNewLabel(pnlTimer,'lblTimer','0.0');
   {
   lblTimer.StyledSettings := ssFamily;
    Inc(duration);
  lblTimer.TextSettings.Font.Size:=25;
    sn = (duration div 10);
  lblTimer.Align := alBottom;
    ss = (duration mod 10);
  lblTimer.Margins.Left:= 130;
    lblTimer.Caption = IntToStr(sn)+'.'+IntToStr(ss);
  lblTimer.Height := 50;
   }
   lblTimer.Width := 200;
    
    
   {
   MyForm.Run;
    duration = 0;
end;
    MyForm = TclForm.Create(Self);
</pre>
    GetTimer= MyForm.AddNewTimer(MyForm,'GetTimer',100);
   
    pnlTimer=MyForm.AddNewPanel(MyForm,'pnlTimer');
    pnlTimer.Align=AlCenter;
    pnlTimer.Height=150;
    pnlTimer.Width=300;
   
    lytTimer = MyForm.AddNewLayout(pnlTimer,'lytTimer');
    lytTimer.Align=ALTop;
    lytTimer.Height = 70;
    lytTimer.Width = 300;
   
    GetStartTimerBtn = MyForm.AddNewProButton(lytTimer,'GetStartTimerBtn','Start');
    clComponent.SetupComponent(GetStartTimerBtn,'{"Align" : "Left",
    "Width" :100,"Height":40,"RoundHeight":2, "RoundWidth":2,"BorderColor":"#7A3E65","BorderWidth":2}');
    MyForm.AddNewEvent(GetStartTimerBtn,tbeOnClick,'BtnStartClick');
   
    GetStopTimerBtn = MyForm.AddNewProButton(lytTimer,'GetStopTimerBtn','Stop');
    clComponent.SetupComponent(GetStopTimerBtn,'{"Align" : "Right",
    "Width" :100,"Height":40,"RoundHeight":2, "RoundWidth":2,"BorderColor":"#7A3E65","BorderWidth":2}');
    MyForm.AddNewEvent(GetStopTimerBtn,tbeOnClick,'BtnStopClick');
   
    lblTimer= MyForm.AddNewLabel(pnlTimer,'lblTimer','0.0');
    lblTimer.StyledSettings = ssFamily;
    lblTimer.TextSettings.Font.Size=25;
    lblTimer.Align = alBottom;
    lblTimer.Margins.Left= 130;
    lblTimer.Height = 50;
    lblTimer.Width = 200;
   
    MyForm.Run;
  }
 


'''Output:'''<br>
'''Output:'''<br>

Revision as of 13:49, 22 August 2024

If there is any code or event that you want to run at certain time intervals or within a certain period of time, the component we need to do this desired job is the TClTimer component.
If we have code that we want to run every second, we write it to the tbeOnTimer event of the TClTimer component. Then, if we set the component's Interval property to 1000, the code we wrote will be executed every second.

AddNewTimer(xOwner:TComponent; xName:String; xInterval:Integer): TClTimer

TComponent : The variable name of the defined component is written. Here you should write the component variable name of whatever your component will be in.

xName : The name of the defined timer should be written.

xMillisecond : Type the trigger time of the time in milliseconds. If we write the time as 0 here, the trigger will not occur at all.

Feature Use of Definition
TClTimer Timer1: TclTimer; A variable belonging to the TclTimer class is created.
AddNewTimer Timer1 = MyForm.AddNewTimer(MyForm,'Timer1',1000); // the action is triggered every 1 second. A new TclTimer is added to the form.
tbeOnTimer MyForm.AddNewEvent(Timer1,tbeOnTimer,'timerShow'); If we want to activate the click event of our TCLTimer component, it is done using AddNewEvent. Here, tbeOnTimer is written as the second parameter. In the last parameter, the action to be triggered on click is specified.
Interval Timer1.Interval = 1000; When creating an object, the time interval to be triggered is specified in the third parameter of the AddNewTimer function. If we set the time to 0 here, the trigger will never occur. In this case, a trigger time can be assigned to the Interval property to enable the triggering. Thus, even if it's set to 0, the triggering will still occur with the interval.

This property specifies the intervals at which the timer component will operate. If the interval is set to 1000, the timer will run every second, meaning 1000 represents 1 second. If the interval value is 500, the timer will run twice per second.

Enabled Timer1.Enabled = True; //or False It is the property that determines whether the TClTimer component will run or not. If the Enabled property is set to true, the timer executes its code at the specified intervals. If the Enabled property is set to false, the timer does not run.

Example:
In the example, the chromometer was built using a timer. You can use it this way or you can use this component for any scheduling you want.

TRObject Syntax
var
  MyForm:TclForm;
  GetTimer: TClTimer;
  GetStartTimerBtn,GetStopTimerBtn : TClProButton;
  duration, sn ,ss : Integer;
  lblTimer : TclLabel;
  lytTimer :TClLayout;
  pnlTimer :TClPanel;

void BtnStartClick;
{
  //GetTimer.Interval = 100; //You can enable it if you don't use a time trigger when calling AddNewTimer.
  GetTimer.Enabled = True;
  MyForm.AddNewEvent(GetTimer,tbeOnTimer,'timerShow');
}

void BtnStopClick;
{
  GetTimer.Enabled = False;
}

void timerShow;
{
  Inc(duration);
  sn = (duration div 10);
  ss = (duration mod 10);
  lblTimer.Caption = IntToStr(sn)+'.'+IntToStr(ss);
}

{
  duration = 0;
  MyForm = TclForm.Create(Self);
  GetTimer= MyForm.AddNewTimer(MyForm,'GetTimer',100); 
  
  pnlTimer=MyForm.AddNewPanel(MyForm,'pnlTimer');
  pnlTimer.Align=AlCenter;
  pnlTimer.Height=150;
  pnlTimer.Width=300;
  
  lytTimer = MyForm.AddNewLayout(pnlTimer,'lytTimer');
  lytTimer.Align=ALTop;
  lytTimer.Height = 70;
  lytTimer.Width = 300;
  
  GetStartTimerBtn = MyForm.AddNewProButton(lytTimer,'GetStartTimerBtn','Start');
  GetStartTimerBtn.Align = alLeft;
  GetStartTimerBtn.Width = 100;
  GetStartTimerBtn.Height = 40;
  GetStartTimerBtn.clProSettings.BorderColor = clAlphaColor.clHexToColor('#7A3E65');
  GetStartTimerBtn.clProSettings.RoundHeight = 2;
  GetStartTimerBtn.clProSettings.RoundWidth = 2;
  GetStartTimerBtn.clProSettings.BorderWidth = 3;
  GetStartTimerBtn.clProSettings.IsRound = True;
  GetStartTimerBtn.SetclProSettings(GetStartTimerBtn.clProSettings);
  MyForm.AddNewEvent(GetStartTimerBtn,tbeOnClick,'BtnStartClick');
  
  
  GetStopTimerBtn = MyForm.AddNewProButton(lytTimer,'GetStopTimerBtn','Stop');
  GetStopTimerBtn.Align = alRight;
  GetStopTimerBtn.Width = 100;
  GetStopTimerBtn.Height = 40;
  GetStopTimerBtn.SetclProSettings(GetStartTimerBtn.clProSettings);
  MyForm.AddNewEvent(GetStopTimerBtn,tbeOnClick,'BtnStopClick');
  
  
  lblTimer= MyForm.AddNewLabel(pnlTimer,'lblTimer','0.0');
  lblTimer.StyledSettings = ssFamily;
  lblTimer.TextSettings.Font.Size=25;
  lblTimer.Align = alBottom;
  lblTimer.Margins.Left= 130;
  lblTimer.Height = 50;
  lblTimer.Width = 200;
  
  MyForm.Run;
}
Base Syntax
var
  MyForm:TclForm;
  GetTimer: TClTimer;
  GetStartTimerBtn,GetStopTimerBtn : TClProButton;
  duration, sn ,ss : Integer;
  lblTimer : TclLabel;
  lytTimer :TClLayout;
  pnlTimer :TClPanel;

Procedure BtnStartClick;
begin
  //GetTimer.Interval := 100; //You can enable it if you don't use a time trigger when calling AddNewTimer.
  GetTimer.Enabled := True;
  MyForm.AddNewEvent(GetTimer,tbeOnTimer,'timerShow');
End;

procedure BtnStopClick;
begin
  GetTimer.Enabled := False;
end;

procedure timerShow;
begin
  Inc(duration);
  sn := (duration div 10);
  ss := (duration mod 10);
  lblTimer.Caption := IntToStr(sn)+'.'+IntToStr(ss);
end;

begin
  duration := 0;
  MyForm := TclForm.Create(Self);
  GetTimer:= MyForm.AddNewTimer(MyForm,'GetTimer',100); 
  
  pnlTimer:=MyForm.AddNewPanel(MyForm,'pnlTimer');
  pnlTimer.Align:=AlCenter;
  pnlTimer.Height:=150;
  pnlTimer.Width:=300;
  
  lytTimer := MyForm.AddNewLayout(pnlTimer,'lytTimer');
  lytTimer.Align:=ALTop;
  lytTimer.Height := 70;
  lytTimer.Width := 300;
  
  GetStartTimerBtn := MyForm.AddNewProButton(lytTimer,'GetStartTimerBtn','Start');
  GetStartTimerBtn.Align := alLeft;
  GetStartTimerBtn.Width := 100;
  GetStartTimerBtn.Height := 40;
  GetStartTimerBtn.clProSettings.BorderColor := clAlphaColor.clHexToColor('#7A3E65');
  GetStartTimerBtn.clProSettings.RoundHeight := 2;
  GetStartTimerBtn.clProSettings.RoundWidth := 2;
  GetStartTimerBtn.clProSettings.BorderWidth := 3;
  GetStartTimerBtn.clProSettings.IsRound := True;
  GetStartTimerBtn.SetclProSettings(GetStartTimerBtn.clProSettings);
  MyForm.AddNewEvent(GetStartTimerBtn,tbeOnClick,'BtnStartClick');
  
  
  GetStopTimerBtn := MyForm.AddNewProButton(lytTimer,'GetStopTimerBtn','Stop');
  GetStopTimerBtn.Align := alRight;
  GetStopTimerBtn.Width := 100;
  GetStopTimerBtn.Height := 40;
  GetStopTimerBtn.SetclProSettings(GetStartTimerBtn.clProSettings);
  MyForm.AddNewEvent(GetStopTimerBtn,tbeOnClick,'BtnStopClick');
  
  
  lblTimer:= MyForm.AddNewLabel(pnlTimer,'lblTimer','0.0');
  lblTimer.StyledSettings := ssFamily;
  lblTimer.TextSettings.Font.Size:=25;
  lblTimer.Align := alBottom;
  lblTimer.Margins.Left:= 130;
  lblTimer.Height := 50;
  lblTimer.Width := 200;
  
  MyForm.Run;
end;

Output:

See Also