Jump to content
Developer Wiki and Function Reference Links Read more... ×
JBenghiat

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
        this->SetResult(kHandledDocumentDoubleClick);
        return false; // Tool action returns result
    }
    else
        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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

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.

×