[vtkusers] Disabling middle mouse button for vtkImageTracerWidget

David Doria daviddoria at gmail.com
Mon Nov 22 20:00:19 EST 2010


I want to disallow the connected line segment mode that can be entered
using the middle mouse button. I tried to derive a class and implement
empty OnMiddleButtonDown and OnMiddleButtonUp functions:

class vtkSimpleImageTracerWidget : public vtkImageTracerWidget
{
public:
  static vtkSimpleImageTracerWidget* New();
  vtkTypeMacro(vtkSimpleImageTracerWidget, vtkImageTracerWidget);

  void OnMiddleButtonDown(){}
  void OnMiddleButtonUp(){}
};

but the line segment functionality still works!

I see this in vtkImageTracerWidget:

void vtkImageTracerWidget::ProcessEvents(vtkObject* vtkNotUsed(object), ... )
{
  vtkImageTracerWidget* self = reinterpret_cast<vtkImageTracerWidget
*>( clientdata );

  switch ( event )
    {
    ...
    case vtkCommand::MiddleButtonPressEvent:
      self->OnMiddleButtonDown();
}

Shouldn't this call to OnMiddleButtonDown() now call my new empty
function and effectively disable this functionality?

Thanks,

David



More information about the vtkusers mailing list