VS:TrackObjectN: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
No edit summary
 
m (1 revision)
(No difference)

Revision as of 17:33, 18 September 2013

.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 (any of these 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;

is used to let the user filter the object that can be returned from the function.

The parameteri 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.

The callback function return true if the passed handle can be returned.

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]]