VS:TrackObjectN: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
 
(wikify, fix caos)
(One intermediate revision by one other user not shown)
Line 5: Line 5:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<desc>
<desc>
Interactively, including highlighting, allows the user to select one object meeting the specified criteria.<BR>
Interactively, including highlighting, allows the user to select one object meeting the specified criteria.
<BR>
 
The callback function (any of these depending on what info is needed):<BR>
The callback function is used to let the user filter the object that can be returned from the function. Any of these below, depending on what info is needed :
<BR>
* FUNCTION Callback(h : HANDLE): BOOLEAN;
FUNCTION Callback(h : HANDLE): BOOLEAN;<BR>
* FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;
FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;<BR>
* FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;
FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;<BR>
 
<BR>
The parameters ''px, py, pz'' pass into the function information about current cursor position in document units.
is used to let the user filter the object that can be returned from the function.<BR>
This callback function is called when tracking over an object; also when click happens over an object.
<BR>
</desc>
The parameteri px,py,pz pass into the function information about current cursor position in document units.<BR>
<BR>
This callback function is called when tracking over an object; also when click happens over an object.<BR>
<BR>
The callback function return true if the passed handle can be returned.</desc>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
Line 73: Line 68:
    
    
   FUNCTION CheckObjCallback(h : HANDLE) : BOOLEAN;
   FUNCTION CheckObjCallback(h : HANDLE) : BOOLEAN;
  {or FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;}
{or FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;}
  {or FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;}
{or FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;}
   BEGIN
   BEGIN
    {any object is ok}
{any object is ok}
    CheckObjCallback := true;
CheckObjCallback := true;
   END;
   END;



Revision as of 03:05, 21 September 2014

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

Description

Interactively, including highlighting, allows the user to select one object meeting the specified criteria.

The callback function is used to let the user filter the object that can be returned from the function. Any of these below, depending on what info is needed :

  • FUNCTION Callback(h : HANDLE): BOOLEAN;
  • FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;
  • FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;

The parameters px, py, pz pass into the function information about current cursor position in document units. This callback function is called when tracking over an object; also when click happens over an object.

PROCEDURE TrackObjectN(
traverseType :INTEGER;
callback :PROCEDURE;
VAR outObj :HANDLE;
VAR p :REAL);
def vs.TrackObjectN(traverseType, callback):
    return (outObj, p)

Parameters

traverseType INTEGER Specify how to traverse the drawing.
callback PROCEDURE The callback that will be called to check if an object meets the requrements to be tracked. See remarks.
outObj HANDLE Returns handle of the object for which the callback returned TRUE.
p REAL Returns coordinates of mouse click.

Example

PROCEDURE Test;
VAR
  h : HANDLE;
  x, y, z : REAL;
  
  FUNCTION CheckObjCallback(h : HANDLE) : BOOLEAN;
	{or FUNCTION CheckObjCallback(h : HANDLE; px, py : REAL) : BOOLEAN;}
	{or FUNCTION CheckObjCallback(h : HANDLE; px, py, pz : REAL) : BOOLEAN;}
  BEGIN
	{any object is ok}
	CheckObjCallback := true;
  END;

BEGIN
	TrackObjectN( 0, CheckObjCallback, h, x, y, z );
	SetSelect( h );
END;
RUN( Test );

Version

Availability: from Vectorworks 2014

See Also

VS Functions:

VS:TrackObject | VS:GetPickObjectInfo

VS Functions:

[[VS:TrackObject]]

| [[VS:GetPickObjectInfo]]