Difference between revisions of "MouseDown event"

From Xojo Documentation

(Example)
 
(One intermediate revision by one other user not shown)
Line 8: Line 8:
 
}}
 
}}
 
{{Description
 
{{Description
|text = The mouse button was pressed inside the control’s region at the location passed in to ''x'', ''y''. }}
+
|text = The mouse button was pressed inside the control's region at the location passed in to ''x'', ''y''. }}
  
 
==Notes==
 
==Notes==
 
 
The coordinates ''x'' and ''y'' are local to the control, i.e. they represent the position of the mouse click relative to the upper-left corner or the [[Control]].
 
The coordinates ''x'' and ''y'' are local to the control, i.e. they represent the position of the mouse click relative to the upper-left corner or the [[Control]].
  
Line 20: Line 19:
 
If you return False, the system handles the MouseDown so the above event handlers do not get called.
 
If you return False, the system handles the MouseDown so the above event handlers do not get called.
  
==Example==
+
=== Controls implementing the MouseDown event ===
 
 
The MouseDown event uses the [[DragItem]] constructor when the user drags the contents of the control. It is:
 
 
 
<rbcode>
 
Dim d As DragItem
 
d = New DragItem(Self, Me.Left, Me.Top, Me.Width, Me.Height)
 
d.Picture = Me.Image
 
d.Drag //Allow the drag
 
</rbcode>
 
 
 
== Controls implementing the MouseDown event ==
 
 
* [[BevelButton]]
 
* [[BevelButton]]
 
* [[Canvas]]
 
* [[Canvas]]
Line 53: Line 41:
 
* [[TextArea]]
 
* [[TextArea]]
 
* [[TextField]]
 
* [[TextField]]
 +
 +
== Sample Code ==
 +
The MouseDown event uses the [[DragItem]] constructor when the user drags the contents of the control. It is:
 +
<rbcode>
 +
Var d As DragItem
 +
d = New DragItem(Self, Me.Left, Me.Top, Me.Width, Me.Height)
 +
d.Picture = Me.Image
 +
d.Drag // Allow the drag
 +
</rbcode>
  
 
==See Also==
 
==See Also==
 
+
[[DragItem]]
[[DragItem]].
 

Latest revision as of 17:31, 16 July 2019

Event


<see below>.MouseDown(x as Integer, y as Integer) As Boolean

Supported for all project types and targets.

The mouse button was pressed inside the control's region at the location passed in to x, y.

Notes

The coordinates x and y are local to the control, i.e. they represent the position of the mouse click relative to the upper-left corner or the Control.

Return True if you are going to handle the MouseDown. In such a case:

  • The Action event, if any, will not execute and the state of the object will not change.
  • You will receive the MouseDrag and MouseUp events.

If you return False, the system handles the MouseDown so the above event handlers do not get called.

Controls implementing the MouseDown event

Sample Code

The MouseDown event uses the DragItem constructor when the user drags the contents of the control. It is:

Var d As DragItem
d = New DragItem(Self, Me.Left, Me.Top, Me.Width, Me.Height)
d.Picture = Me.Image
d.Drag // Allow the drag

See Also

DragItem