From Clomosy Docs

(Created page with "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: {| class="wiki...")
 
No edit summary
Line 20: Line 20:


'''Example:'''
'''Example:'''
:''Basic Syntax''
  var
  var
   myForm:TclForm;
   myForm:TclForm;
Line 64: Line 65:
   
   
  End;
  End;
:''TRObject Syntax''
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 = 300;
GestureImg.Width = 300;
MyForm.AddNewEvent(GestureImg, tbeOnMouseDown,
'onFormMouseDown');
MyForm.AddNewEvent(GestureImg, tbeOnMouseUp, 'onFormMouseUp');
MyForm.AddNewEvent(GestureImg, tbeOnMouseMove,
'onFormMouseMove');
myForm.Run;
}

Revision as of 10:10, 5 December 2023

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 MyForm.AddNewEvent(GestureImg, tbeOnMouseDown, 'onFormMouseDown'); 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 MyForm.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 MyForm.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 MyForm.clFormMousePosX
clSenderMousePosX MyForm.clSenderMousePosX It represents the X-coordinate of the mouse cursor over a component or form.
clFormMousePosY MyForm.clFormMousePosY
clSenderMousePosY MyForm.clSenderMousePosY It represents the Y-coordinate of the mouse cursor over a component or form.

Example:

Basic Syntax
var
 myForm:TclForm;
 MouseLbl:TclLabel;
 GestureImg:TClImage;

Procedure onFormMouseMove;
begin

 MouseLbl.Text := IntToStr(MyForm.clFormMousePosX) + ','+ IntToStr(MyForm.clFormMousePosY);
 MouseLbl.Text := IntToStr(MyForm.clSenderMousePosX) + ','+ IntToStr(MyForm.clSenderMousePosY);
End;
procedure   onFormMouseDown;
begin

 MouseLbl.Text := IntToStr(MyForm.clFormMousePosX) + ','+ IntToStr(MyForm.clFormMousePosY);
 MouseLbl.Text := IntToStr(MyForm.clSenderMousePosX) + ','+ IntToStr(MyForm.clSenderMousePosY);
end;

procedure onFormMouseUp;
begin 
 MouseLbl.Text := IntToStr(MyForm.clFormMousePosX) + ','+ IntToStr(MyForm.clFormMousePosY);
 MouseLbl.Text := IntToStr(MyForm.clSenderMousePosX) + ','+ IntToStr(MyForm.clSenderMousePosY);
end; 

begin
 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 := 300;
 GestureImg.Width := 300;

 MyForm.AddNewEvent(GestureImg, tbeOnMouseDown, 'onFormMouseDown'); 
 MyForm.AddNewEvent(GestureImg, tbeOnMouseUp, 'onFormMouseUp');
 MyForm.AddNewEvent(GestureImg, tbeOnMouseMove, 'onFormMouseMove');

 myForm.Run;

End;
TRObject Syntax
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 = 300;
GestureImg.Width = 300;

MyForm.AddNewEvent(GestureImg, tbeOnMouseDown, 
'onFormMouseDown'); 
MyForm.AddNewEvent(GestureImg, tbeOnMouseUp, 'onFormMouseUp');
MyForm.AddNewEvent(GestureImg, tbeOnMouseMove, 
'onFormMouseMove');

myForm.Run;

}