[vtkusers] Disabling middle mouse button for vtkImageTracerWidget

Dean Inglis dean.inglis at camris.ca
Tue Nov 23 08:29:33 EST 2010


> David,
> I think except for this line with overrides the pointer type for "self" 
> and
>  keeps the functionality in vtkImageTracerWidget...
>
>  vtkImageTracerWidget* self = reinterpret_cast<vtkImageTracerWidget
>
> It looks to me like ProcessEvents() is the callback function used for all 
> of
> the callback operations, and the way ProcessEvents() is coded it defeats 
> sub
> classing. Hope that helps,

>Hm, so I would have to implement the ProcessEvents() function and
>copy/paste everything except the middle mouse button stuff? That seems
>quite silly... Is there a reason that it is implemented like this
>instead of allowing subclassing?

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






More information about the vtkusers mailing list