Difference between revisions of "Placard.MouseDown"

From Xojo Documentation

(Redirected page to MouseDown event)
 
(Notes)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
#REDIRECT [[MouseDown event]]
+
{{EventBox
 +
| name=MouseDown
 +
| ownertype=class
 +
| owner=[[Placard]]
 +
| parameters=x as [[Integer]], y as [[Integer]]
 +
| returntype=[[Boolean]]
 +
| platform=all
 +
}}
 +
{{Description
 +
|text = 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 [[Placard]].
 +
 
 +
[[Return]] [[True]] if you are going to handle the MouseDown. In such a case:<br>
 +
* The Action event, if any, will not execute and the state of the object will not change.
 +
* You will receive the [[Placard.MouseDrag|MouseDrag]] and [[Placard.MouseUp|MouseUp]] events.
 +
 
 +
If you return False, the system handles the MouseDown so the [[Placard.MouseDrag|MouseDrag]] and [[Placard.MouseUp|MouseUp]] event handlers do not get called.
 +
 
 +
== 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==
 +
[[DragItem]] class; [[IsContextualClick]] method

Latest revision as of 22:34, 7 August 2021

Event


Placard.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 Placard.

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 MouseDrag and MouseUp event handlers do not get called.

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 class; IsContextualClick method