[vtkusers] Disabling middle mouse button for vtkImageTracerWidget

Dean Inglis dean.inglis at camris.ca
Tue Nov 23 09:24:24 EST 2010


how about overriding with a do nothing method? e.g.

void vtkSimpleImageTracerWidget::OnMiddleButtonUp()
{
  return;
}


----- Original Message ----- 
From: "David Doria" <daviddoria at gmail.com>
To: "Dean Inglis" <dean.inglis at camris.ca>
Cc: "vtkusers archive" <vtkusers at vtk.org>
Sent: Tuesday, November 23, 2010 8:55 AM
Subject: Re: [vtkusers] Disabling middle mouse button for 
vtkImageTracerWidget


>> David,
>>
>> vtkImageTracerWidget is written in the old style of widgets (inherit from
>> vtk3DWidget)
>> and so ProcessEvents has this method signature common to most/all(?)
>> vtk3DWidget subclasses.
>> You could subclass the widget's AddObservers method or set the widget's
>> interactor,
>> and after the SetEnabled call, you could remove the command from the
>> interactor with
>> RemoveObservers.
>>
>> Dean
>
> Hmm, even with this:
>
> void vtkSimpleImageTracerWidget::AddObservers(void)
> {
>  // Listen for the following events
>  vtkRenderWindowInteractor *i = this->Interactor;
>  if (i)
>    {
>    i->AddObserver(vtkCommand::MouseMoveEvent, this->EventCallbackCommand,
>                   this->Priority);
>    i->AddObserver(vtkCommand::LeftButtonPressEvent,
>                   this->EventCallbackCommand, this->Priority);
>    i->AddObserver(vtkCommand::LeftButtonReleaseEvent,
>                   this->EventCallbackCommand, this->Priority);
>    i->AddObserver(vtkCommand::RightButtonPressEvent,
>                   this->EventCallbackCommand, this->Priority);
>    i->AddObserver(vtkCommand::RightButtonReleaseEvent,
>                   this->EventCallbackCommand, this->Priority);
>    }
> }
>
> it still keeps the middle click line segment functionality.
>
> I also tried:
>
> void MyInteractorStyle::InitializeTracer()
> {
> ...
>  this->Tracer->On();
>
>  this->Interactor->RemoveObserver(vtkCommand::MiddleButtonPressEvent);
>  this->Interactor->RemoveObserver(vtkCommand::MiddleButtonReleaseEvent);
> ...
> }
>
> and the line segments STILL appear!
>
> David 




More information about the vtkusers mailing list