Jump to content
Developer Wiki and Function Reference Links ×

hopefully another simple question, setting active tool


ionw

Recommended Posts

Good day all,

I completed my custom selection 'eyedropper' tool. Once I finished it, I realized that the structure would lend itself to being a 'tool eyedropper.'

For all the defined tool selectors the job was easy:

	CASE objType OF
		2: SetTool(-201);
		3: SetTool(-203);
		4: SetTool(-205);
		5: SetTool(-207);
		6: SetTool(-202);
		10: SetTool(-200);
		13: SetTool(-217);
		15: SetTool(-209);
		21: SetTool(-210);
		63: SetTool(-208);
		68: SetTool(-208);
		89: SetTool(-318);
	END;

Where I am running into a problem is setting to a specific PIO. Thanks to the efforts of Mr. Dunning, I have the internal name of the PIO. The closest I found was CreateCustomObject(PIOName,pX,pY,root); But, I don't want to create an object, I simply want to activate the tool, just as if the user had clicked on the icon, or executed a keyboard shortcut.

I don't need to invoke the Preferences dialog, since to have this part of the script run, the user has to click on an already created object.

If there are any ideas, I would love to have the input.

Cheers,

ion

Link to comment

For now, I have simply adopted a repetition loop until the user hits esc, or I suppose switches the active tool,

IF objType = 86 THEN
BEGIN
 WHILE (k <> 27) DO
  BEGIN
   IF (KeyDown(k) = FALSE) THEN
    BEGIN
     GetPt(x,y);
     h := CreateCustomObject(GetName(GetRecord(OHan,numrecords(OHan))),x,y,0);
   END;
  END;
END;

Then I run into the issue that seems to be very prevalent on the board, that calling PIO A from within PIO B causes the instances of PIO A to not generate until PIO B completes execution.

I have gone through most posts over the last year here that reference resetobject, redraw etc. I spent time on the VectorLab site and reading through the Event enabling by Charles Chandler. I am simply not finding a solution that either solves my situation (mostly a Tool PIO calling a Point PIO), or I haven't quite made the leap to see what I need to do to have at least a ghost representation of the called PIO as they are placed.

any thoughts would be greatly appreciated. Thank you,

Ion

Link to comment

Thank you Charles, I thought that I had seen a function that called tools by name, but could not find it in the VS reference files, or on VCOR, though I am sure it is in one of those places. I must have seen it in one of the early threads here.

I found the description on your page, www.scs-inc.us but seems to be undefined just about anywhere else.

I appreciate the help, as it seems to work exactly as I intended.

thanks again,

ion

Link to comment

The functions with the green title bars are functions that were coded in the SDK, rather than in the VW core. This makes no difference to you, since they act the same as built-in functions when called from VectorScript. But for the people who work on the underlying code of these functions at NNA, it helps to know where to go looking for the code. The only other difference is that these functions are not documented in the standard VectorScript reference.

Anyway, the SetToolByName function was implemented in 13.0.1.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...