Difference between revisions of "VS:MouseDown"

From Vectorworks Developer
Jump to: navigation, search
m (1 revision)
 
(One intermediate revision by one user not shown)
Line 5: Line 5:
 
-----------------------------------------------------------------------------------------------------------
 
-----------------------------------------------------------------------------------------------------------
 
<desc>
 
<desc>
Function MouseDown returns TRUE if a mouse down event has occurred within the active document window.
+
Return TRUE if a mouse down event has occurred within the active document window.
 
</desc>
 
</desc>
  
Line 13: Line 13:
 
FUNCTION MouseDown(VAR pX,pY:REAL) : BOOLEAN;
 
FUNCTION MouseDown(VAR pX,pY:REAL) : BOOLEAN;
 
</funcDef>
 
</funcDef>
 +
 
<funcDef lang="py">
 
<funcDef lang="py">
 
def vs.MouseDown():
 
def vs.MouseDown():
     return (BOOLEAN, p)
+
     return (bool, (px, py))
 
</funcDef>
 
</funcDef>
 
</def>
 
</def>
Line 25: Line 26:
 
p
 
p
 
REAL
 
REAL
Returns coordinates of mouse click.
+
Coordinates of mouse click.
 +
Remark for VW2014 python: Always an empty tuple (0, 0) - use GetMouse() if down == True
 
</line>
 
</line>
 
</lineList>
 
</lineList>
Line 43: Line 45:
 
==== Python ====
 
==== Python ====
 
<code lang="py">
 
<code lang="py">
 +
down = False
 +
while not down:
 +
    down, pt = vs.MouseDown()  # pt is a tuple (x, y)
  
 +
vs.AlrtDialog(str(pt))
 
</code>
 
</code>
 
</sample>
 
</sample>

Latest revision as of 04:36, 9 July 2019

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Return TRUE if a mouse down event has occurred within the active document window.
FUNCTION MouseDown(
VAR pX,pY  :REAL) : BOOLEAN;
def vs.MouseDown():
    return (bool, (px, py))

Parameters

p REAL Coordinates of mouse click.

Example

VectorScript

REPEAT
UNTIL MouseDown(x1,y1);
REPEAT
UNTIL MouseDown(x2,y2);
MoveTo(x1,y1);
LineTo(x2,y2);

Python

down = False
while not down:
    down, pt = vs.MouseDown()  # pt is a tuple (x, y)

vs.AlrtDialog(str(pt))

Version

Availability: from All Versions
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox