Jump to content

Collecting an additional point after double-click

Recommended Posts

I have a custom insertion tool for a point plug-in that requires an additional click (for attaching it to another object). This works fine with two clicks, but when the user double-clicks, I can't figure out how to request the third point.


I've tried implementing DrawingDoubleClick(), but I can't seem to do anything in that event that keeps the tool handler from executing HandleComplete()

Share this post

Link to post

I think you should do nothing in HandleComplete() and make GetStatus() return gSDK->OnePointToolStatus() so you can do your stuff the next time HandleComplete() is called.

Share this post

Link to post

Thanks for the suggestion, but no luck so far. 


If I have GetStatus() return kCollectingPoints immediately after catching the double-click, HandleComplete() still runs. 


If I do nothing in HandleComplete(), the points still clear and the status is set to kAwaitingFirstClick. 


I have not found a way to prevent HandleComplete() from running. The tool seems to be ignoring the status after the double-click. 

Share this post

Link to post

OK, figured it out. I had originally looked at the default behavior for VWTool_EventSink::Execute in VWExtensionTool.cpp, but misread the logic.


In order to have custom handling of the double-click, you need to return false, otherwise the method returns a kToolCompleted message. The default message will terminate the tool operation and switch to the selection cursor, which is why I initially returned false.


So, my implementation of DrawingDoubleClick() looks like this:

    if (fBarState[kModeLinkButton] == 1) {// Wants object link
        return false; // Tool action returns result
        return true; // Tool action complete, no special handling, one point collected

Setting the result to kHandledDocumentDoubleClick adds a second point equal to the first and goes back to GetStatus() without calling HandleComplete(). This way the object preview does not rotate with the third click.


If you want the preview to rotate, you can set the result to kToolCollectingPoints and adjust the expectations of two or three points accordingly.


My GetStatus() returns a three point tool status if the mode option is true, otherwise a two point tool status


Share this post

Link to post

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.

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.


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

  • Create New...