[vtkusers] The vtkRenderWindowInteractor only can accept one observer, bug?
kdsfinger at gmail.com
kdsfinger at gmail.com
Sat Oct 7 08:25:06 EDT 2006
I found this bug in the
Insight/InsightApplications/LiverTumorSegmentation/ImageSliceViewer.cpp
Althought it is used in itk, it's a vtk program.
In the function
void
ImageSliceViewer
::SetInteractor( vtkRenderWindowInteractor * interactor )
{
m_RenderWindow->SetInteractor( interactor );
vtkInteractorStyleImage * interactorStyle = vtkInteractorStyleImage::New();
interactor->SetInteractorStyle( interactorStyle );
interactorStyle->Delete();
interactor->AddObserver( ::vtkCommand::LeftButtonPressEvent,
m_InteractorObserver );
interactor->AddObserver( ::vtkCommand::LeftButtonReleaseEvent,
m_InteractorObserver );
interactor->AddObserver( ::vtkCommand::MouseMoveEvent, m_InteractorObserver );
}
The interactor only accept the first added observer and neglect the
rest. In the above case, only the LeftButtonPressEvent is observed. If
I switch the sequence such that the LeftButtonReleaseEvent is added
before LeftButtonPressEvent, the LeftButtonReleaseEvent will be
observed while the LeftButtonPressEvent is not.
How can I observe multiple mouse events? Thanks for comments.
zl2k
More information about the vtkusers
mailing list