Difference between revisions of "VS:MouseDown"

From Vectorworks Developer
Jump to: navigation, search
m (1 revision)
Line 6: Line 6:
 
<desc>
 
<desc>
 
Function MouseDown returns TRUE if a mouse down event has occurred within the active document window.
 
Function MouseDown returns TRUE if a mouse down event has occurred within the active document window.
 +
 +
Remark for VW2014 python: return value for the point is always an empty tuple (0, 0)
 
</desc>
 
</desc>
  
Line 13: Line 15:
 
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 43: Line 46:
 
==== 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>

Revision as of 03:32, 9 July 2019

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

Description

Function MouseDown returns TRUE if a mouse down event has occurred within the active document window.

Remark for VW2014 python: return value for the point is always an empty tuple (0, 0)

FUNCTION MouseDown(
VAR pX,pY  :REAL) : BOOLEAN;
def vs.MouseDown():
    return (bool, (px, py))

Parameters

p REAL Returns 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