From Clomosy Docs
procedure AddNewEvent(AComponent: TCLComponent; AEvent: TCLBasisEvent; AProcedure: String);
AComponent : The name of the object where the event will occur must be specified.
AEvent : The desired event should be written. For event properties used in Clomosy, refer to the TCLBasisEvent heading.
AProcedure : The name of the pre-defined procedure that should occur after the event is triggered must be written.
It is a function or action triggered when a specific event occurs, such as user interaction (e.g., clicking a button, mouse movement) or system status (e.g., completion of a file or network connection loss).
This event triggers the execution of a procedure called an event handler.
Example
In the example, "tbeOnClick" property is assigned to a button. When the button is clicked, the camera is activated for barcode reading (CallBarcodeReader), and the scanned barcode is transferred to a TclEdit object.
Before using AddNewEvent, don't forget to define the procedure that will be redirected to.
Var
MyForm : TclForm;
testBtn : TClButton;
testEdit : TclEdit;
void BtnOnClick;
{
MyForm.CallBarcodeReader(testEdit);
}
{
MyForm = TclForm.Create(Self);
testEdit = MyForm.AddNewEdit(MyForm,'testEdit','Barcode here ...');
testEdit.Align = alTop;
testEdit.Height = 40;
testBtn = MyForm.AddNewButton(MyForm,'testBtn','Scan Barcode...');
testBtn.Align = alCenter;
testBtn.Height = 100;
testBtn.Width = 200;
MyForm.AddNewEvent(testBtn,tbeOnClick,'BtnOnClick');
MyForm.Run;
}
Output:
TCLBasisEvent
Use of;
Form1.AddNewEvent(EventControl:TCLControl;BasisEvent:TCLBasisEvent; xCode:String);
Example usage;
Form1.AddNewEvent(Button1,tbeOnClick, 'ShowMessage(''Hello'')');
Form Events
| Feature | Definition |
|---|---|
| tbeOnFormActivate | This is an event that will be triggered when the form becomes active. |
| tbeOnFormClose | This is an event that will be triggered when the form is closed. |
| tbeOnFormCloseQuery | This is an event that will be triggered when the form is closed. |
| tbeOnFormDeactivate | This is an event that occurs when a form is disabled. When a form is disabled, it typically means that the controls belonging to that form are not responsive to user interactions. |
| tbeOnFormHide | The tbeOnFormHide event is triggered when the form is hidden, and the procedure assigned to this event is executed. In this procedure, tasks that need to be performed when the form is hidden are carried out. |
| tbeOnFormShow | The tbeOnFormShow event is triggered when the form becomes visible. |
| tbeOnVirtualKeyboardShown | This is an event that will be triggered when the keyboard is opened. |
| tbeOnVirtualKeyboardHidden | This is an event that will be triggered when the keyboard is hidden. |
Control Events
| Feature | Definition |
|---|---|
| tbeOnClick | This event occurs when a button click action is triggered. This is usually the most basic event and allows the user to initiate an action. |
| tbeOnEnter | This event is triggered when a component is focused (selected with the keyboard or clicked with the mouse). This is especially important for keyboard navigation and interaction. |
| tbeOnExit | This event is commonly used for actions that need to be performed when exiting a input field, such as when transitioning from one component to another. |
| tbeOnItemClick | This event is typically used to make a selection between items listed, or to perform a specific action when an item is clicked. See page for more information. |
| tbeOnChange | This event is triggered when the value of a component changes. It is commonly used in components that can be modified by the user, such as input fields. |
| tbeOnGetQRCode | This is used when hovering over or clicking on a component that generates a QRCode. In situations where a QR code needs to be generated, this event is triggered. |
| tbeOnTimer | This event occurs when a timer component (usually TClTimer) is triggered. It is used to perform tasks that are repeated at specific intervals. |
| tbeOnMotionSensorChoosing | |
| tbeOnMotionSensorStateChanged | |
| tbeOnMQTTStatusChanged | The tbeOnMQTTStatusChanged event is triggered when the MQTT status is changed. |
| tbeOnMQTTPublishReceived | This is the trigger event used when a received status over MQTT is intended to be published. |
| tbeOnGridCellClick | This is the event triggered when you click on the TclStringGrid component. |
| tbeOnGesture | This is the event triggered when you click on the TclStringGrid component. It refers to the event triggered by a specific movement or action on a particular component (such as an image or a form). See page for more information. |
| tbeOnMouseDown | It is an event triggered when a component (such as a button or an image) is clicked with the mouse. This event occurs when the mouse button is pressed. See page for more information. |
| tbeOnMouseUp | It is an event triggered when a component is released after being clicked with the mouse. This event represents the moment when the mouse button is released. See page for more information. |
| tbeOnMouseMove | It is an event triggered when you move the mouse pointer over a component. This event occurs when you move the mouse pointer. See page for more information. |
| tbeOnKeyDown | The event triggered when a key is pressed on the keyboard. See page for more information. |
| tbeOnFormKeyDown | The event triggered when a key is pressed on the keyboard. See page for more information. |
| tbeOnKeyUp | The event triggered when a key press operation is completed on the keyboard. See page for more information. |
| tbeOnFormKeyUp | The event triggered when a key press operation is completed on the keyboard. See page for more information. |
Virtual Keyboard
It is a feature that allows mobile applications to control the virtual keyboard. It is used to perform actions such as viewing, hiding, or monitoring the status of the virtual keyboard on mobile devices.