Jump to content
Developer Wiki and Function Reference Links ×

Collecting an additional point after double-click


JBenghiat

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()

Link to comment

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. 

Link to comment

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

 

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...