From Clomosy Docs
No edit summary |
ClomosyAdmin (talk | contribs) No edit summary |
||
| Line 84: | Line 84: | ||
* [[Components]] | * [[Components]] | ||
* [[Object Properties]] | * [[Object Properties]] | ||
{{#seo:|description=Learn how to handle Mouse Movements in Clomosy Docs. Implement responsive and dynamic actions based on user input for better app interaction.}} | |||
Revision as of 11:41, 20 December 2024
Mouse movements refer to various physical movements made by computer users on the screen using a mouse device. The mouse is used to move a cursor on the computer screen and perform actions like clicking, dragging, etc.
Mouse movements provide computer users with an interactive interface. In the TRObject programming language, you can look at the following movements and purposes for using the event triggered when you move the mouse pointer over a component:
| Feature | Use of | Definition |
|---|---|---|
| tbeOnMouseDown | Form1.AddNewEvent(GestureImg, tbeOnMouseDown, 'onFormMouseDown'); //GestureImg:TclImage | 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. |
| tbeOnMouseUp | Form1.AddNewEvent(GestureImg, tbeOnMouseUp, 'onFormMouseUp'); | 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. |
| tbeOnMouseMove | Form1.AddNewEvent(GestureImg, tbeOnMouseMove, 'onFormMouseMove'); | It is an event triggered when you move the mouse pointer over a component. This event occurs when you move the mouse pointer. |
| clFormMousePosX | Form1.clFormMousePosX | |
| clSenderMousePosX | Form1.clSenderMousePosX | It represents the X-coordinate of the mouse cursor over a component or form. |
| clFormMousePosY | Form1.clFormMousePosY | |
| clSenderMousePosY | Form1.clSenderMousePosY | It represents the Y-coordinate of the mouse cursor over a component or form. |
Example
var
myForm:TclForm;
MouseLbl:TclLabel;
GestureImg:TClImage;
void onFormMouseMove;
{
MouseLbl.Text = IntToStr(MyForm.clFormMousePosX) + ','+
IntToStr(MyForm.clFormMousePosY);
MouseLbl.Text = IntToStr(MyForm.clSenderMousePosX) + ','+
IntToStr(MyForm.clSenderMousePosY);
}
void onFormMouseDown;
{
MouseLbl.Text = IntToStr(MyForm.clFormMousePosX) + ','+
IntToStr(MyForm.clFormMousePosY);
MouseLbl.Text = IntToStr(MyForm.clSenderMousePosX) + ','+
IntToStr(MyForm.clSenderMousePosY);
}
void onFormMouseUp;
{
MouseLbl.Text = IntToStr(MyForm.clFormMousePosX) + ','+
IntToStr(MyForm.clFormMousePosY);
MouseLbl.Text = IntToStr(MyForm.clSenderMousePosX) + ','+
IntToStr(MyForm.clSenderMousePosY);
}
{
myForm = TClForm.Create(Self);
MouseLbl = myForm.AddNewLabel(MyForm, 'MouseLbl','--');
MouseLbl.Align = alTop;
MouseLbl.Height = 20;
GestureImg = myForm.AddNewImage(MyForm, 'GestureImg');
MyForm.setImage(GestureImg,'https://clomosy.com/demos/bg.png');
GestureImg.Align = alCenter;
GestureImg.Height = 270;
GestureImg.Width = 150;
MyForm.AddNewEvent(GestureImg, tbeOnMouseDown,
'onFormMouseDown');
MyForm.AddNewEvent(GestureImg, tbeOnMouseUp, 'onFormMouseUp');
MyForm.AddNewEvent(GestureImg, tbeOnMouseMove, 'onFormMouseMove');
myForm.Run;
}