VS:RunTempTool: Difference between revisions

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

Revision as of 14:36, 12 August 2013

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

Description

Runs a temp tool. The call waits until the tool has finished. The callback function is notified for the tool events.

PROCEDURE RunTempTool(
toolCallback :PROCEDURE;
initialScroll :BOOLEAN);
def vs.RunTempTool(toolCallback, initialScroll):
    return None

Parameters

toolCallback PROCEDURE Procedure that will be called with the tool events.
initialScroll BOOLEAN For experts. Pass FALSE if you want simple temp tool. Setting it to TRUE will add one extra point (0,0) before the tool runs. This will make the tool scroll before the first click. This means that you tool handler must recognize and skip that extra firs

Example

VectorScript

PROCEDURE Test;
VAR
    pt1, pt2 : POINT;

    FUNCTION TempToolCallback(action, msg1, msg2 : LONGINT) : LONGINT;
    VAR pt : POINT;
    BEGIN
         TempToolCallback := 0;
         CASE action OF
             3: BEGIN {kOnToolDoSetupEventID}
		             vstSetHelpString ( 'Just click once.' );
             END;

             103 : BEGIN {kToolDrawEventID}
                 vstGetCurrPt2D( pt.x, pt.y );
                 vstDrawCoordLine( pt.x, pt.y, pt1.x, pt1.y );
                 vstDrawCoordLine( pt.x, pt.y, pt2.x, pt2.y );
             END;
         END;
    END;

BEGIN
    pt1.x := 0; pt1.y := 0;
    pt2.x := 100mm; pt2.y := 100mm;
    RunTempTool( TempToolCallback, FALSE );
END;
RUN( Test );

Python


Version

Availability: from Vectorworks 2010