[vtkusers] vtkCommand mouse doubleclick
Marc Cotran
marc at cotran.ca
Thu Jul 5 11:51:22 EDT 2007
Hi Kang Jin,
You can create a subclass of vtkInteractorStyle and reimplement the
mouse events in the following way (I have not tried this, but it should
work):
* create an int member variable called mouseMoves in the interactor
and initialize it to 0
* create another int variable called leftClicks and initialize it to
0 as well
* in OnLeftButtonDown(), if mouseMoves > 0, set mouseMoves = 0
* in OnMouseMove(), mouseMoves++;
* in OnLeftButtonUp(), if mouseMoves == 0, increment leftClicks
(leftClicks++)
* then in the same method, check if leftClicks == 2 (double click),
if so, you have captured a double click
You may want to allow more than 0 mouse moves (like 5 or so) because
people tend to move the mouse slightly as they double click. You may
also want to create your own event (LeftDoubleClickEvent) and invoke it
at the appropriate time.
hth
Marc
kang jin wrote:
> Hi.everybody.
> I don't know how can I use mouse double click event on VTK application.
> For example,there is no the mouse double click event in vtkCommand event.
> Development environment of my program is visualstudio 2005(MFC).
> Please help me
>
> ------------------------------------------------------------------------
> Shape Yahoo! in your own image. Join our Network Research Panel today!
> <http://us.rd.yahoo.com/evt=48517/*http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list