From Clomosy Docs
MyForm.Clsender : TCLComponent;
In Clomosy, the ClSender property allows accessing the object that triggered an event within the event. When an event is triggered, you can obtain the reference of the object associated with that event through the ClSender property.
For example, in the OnClick event of multiple created buttons, you can use the ClSender property to access the button that was clicked. The ClSender property is generally of type TObject and represents a general object reference. However, by casting this reference to a specific type, you can access the properties and methods of that object.
For example, to access a button;
TClProButton(Myform.Clsender);
To access the properties of this object after calling the button;
TClProButton(Myform.Clsender).Caption
TClProButton(Myform.Clsender).Hint
And assignments can also be made to this object;
TClProButton(Myform.Clsender).Visible = false;
Example
Var
MyForm:TclForm;
testPanel : TclProPanel;
testBtn : TClProButton;
i : Integer;
void BtnOnClick;
var
clickedBtn:TClProButton;
{
clickedBtn = TClProButton(Myform.Clsender);
ShowMessage(clickedBtn.Caption); //TClProButton(Myform.Clsender).Caption
ShowMessage(clickedBtn.Hint);
clickedBtn.Caption = '+++';
}
{
MyForm=TclForm.Create(self);
testPanel=MyForm.AddNewProPanel(MyForm,'testPanel');
testPanel.Align = AlCenter;
testPanel.Width = 200;
testPanel.Height = 300;
testPanel.clProSettings.IsRound = True;
testPanel.clProSettings.RoundHeight = 10;
testPanel.clProSettings.RoundWidth = 10;
testPanel.clProSettings.BorderColor = clAlphaColor.clHexToColor('#3a32a8');
testPanel.clProSettings.BorderWidth = 2;
testPanel.SetclProSettings(testPanel.clProSettings);
for (i = 0 to 4)
{
testBtn = MyForm.AddNewProButton(testPanel,'testBtn'+IntToStr(i+1),'');
testBtn.Align = AlTop;
testBtn.caption = 'testBtn'+IntToStr(i+1);
testBtn.Margins.Right = 5;
testBtn.Margins.Left = 5;
testBtn.Margins.Top = 5;
testBtn.Height = 50;
MyForm.SetImage(testBtn,'https://clomosy.com/demos/foodInformationBox.png');
testBtn.Hint = 'Document '+IntToStr(i);
MyForm.AddNewEvent(testBtn,tbeOnClick,'BtnOnClick');
}
MyForm.Run;
}