JBenghiat Posted August 12, 2019 Share Posted August 12, 2019 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() Quote Link to comment
Stefan Bender Posted August 13, 2019 Share Posted August 13, 2019 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. Quote Link to comment
JBenghiat Posted August 13, 2019 Author Share Posted August 13, 2019 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. Quote Link to comment
JBenghiat Posted August 13, 2019 Author Share Posted August 13, 2019 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 Quote Link to comment
Recommended Posts
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.