From Clomosy Docs

Revision as of 12:52, 6 November 2024 by ClomosyManager (talk | contribs)

"clDoClick" is a part of the Clomosy library and allows you to programmatically perform a click operation on a component or object.

  • AComponent: The component or object name to click on.

When this function is called, a click operation is performed on the specified component or object. This can be used to simulate the user interface of the program or for automation purposes. For example, it can be used to trigger a specific action by clicking on a button.

Example
In the example, the click feature is enabled when the project is opened.
TRObject Syntax

var
  MainForm : TclForm;
  iconImg : TCLProImage;

void iconBtnClick;
{
  ShowMessage('Hello!');
}

{
  MainForm = TclForm.Create(self);
  MainForm.SetFormBGImage('https://clomosy.com/demos/bg.png');
  
  iconImg  = MainForm.AddNewProImage(MainForm,'iconImg');
  clComponent.SetupComponent(iconImg,'{"Align" : "Top","MarginTop":40,"MarginLeft":5,
  "Height":150,"ImgUrl":"https://clomosy.com/demos/moon.png", "ImgFit":"yes"}');
  MainForm.AddNewEvent(iconImg,tbeOnClick,'iconBtnClick');
  clDoClick(iconImg);
  
  MainForm.Run;
}

Base Syntax

var
  MainForm : TclForm;
  iconImg : TCLProImage;

procedure iconBtnClick;
begin
  ShowMessage('Hello!');
end;

begin
  MainForm :=TclForm.Create(self);
  MainForm.SetFormBGImage('https://clomosy.com/demos/bg.png');
  
  iconImg  := MainForm.AddNewProImage(MainForm,'iconImg');
  clComponent.SetupComponent(iconImg,'{"Align" : "Top","MarginTop":40,"MarginLeft":5,
  "Height":150,"ImgUrl":"https://clomosy.com/demos/moon.png", "ImgFit":"yes"}');
  MainForm.AddNewEvent(iconImg,tbeOnClick,'iconBtnClick');
  clDoClick(iconImg);
  
  MainForm.Run;
end;

See Also