From Clomosy Docs
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 | It represents the X (horizontal) coordinate of the mouse cursor on the form. |
clFormMousePosY | Form1.clFormMousePosY | It represents the Y (vertical) coordinate of the mouse cursor on the form. |
clSenderMousePosX | Form1.clSenderMousePosX | It represents the X coordinate of the mouse cursor over an object (such as TclPanel, TclImage, etc.). |
clSenderMousePosY | Form1.clSenderMousePosY | It represents the Y coordinate of the mouse cursor over an object (such as TclPanel, TclImage, etc.). |
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; }