[vtkusers] How to manage events between vtkRenderWindowInteractor and Observers?

kent williams nkwmailinglists at gmail.com
Fri Jul 10 12:47:44 EDT 2009


I'll try to be concise and clear but this is a bit convoluted to
describe. I'm open to suggestions on better ways to do this.

GOAL: add a context menu to a vtkRenderWindow, that pops up on Control
+ Right Mouse Click

METHOD USED: Add an observer on the vtkRenderWindowInteractor instance.

PROBLEM: The right-mouse-click event gets processed by both by my
Observer and other Observers in the view.

SYMPTOM: After menu pops up, once menu is dismissed, the view is left
in 'zooming' mode -- i.e. moving the mouse zooms the window until I
click the mouse in the window again.

I've partially fixed this problem.  In my vtkCommand subclass, I call
vtkCommand::SetAbortFlag(true). This pops up the menu, and if I select
one of the menu items, the render window doesn't go into zoom mode.

But if I dismiss the menu without picking a menu item, either by
hitting Escape, or clicking anywhere outside the menu, the
RenderWindow is left in the 'zooming state.



More information about the vtkusers mailing list