[vtkusers] VtkSphereWidget unable to handle the right or left click...
Dean Inglis
dean.inglis at camris.ca
Thu Mar 4 20:08:56 EST 2010
Hi David,
>I believe it is because that event is simply not handled by the widget. If
>you look here:
>http://www.vtk.org/doc/nightly/html/classvtkSphereWidget.html#_details
>
>You will see InteractionEvent, but not LeftButton*
>
>I tried to subclass the sphere widget and catch the event:
>http://www.vtk.org/Wiki/VTK/Examples/Widgets/SphereWidgetEvents
>
>but it didn't work. Anyone know why?
this is because in the parent class, the constructor sets a specific static
(non-virtual) method:
vtkSphereWidget::vtkSphereWidget()
{
this->State = vtkSphereWidget::Start;
this->EventCallbackCommand->SetCallback(vtkSphereWidget::ProcessEvents);
MySphereWidget would need to implement the static method ProcessEvents:
void MySphereWidget::ProcessEvents(vtkObject* vtkNotUsed(object),
unsigned long event,
void* clientdata,
void* vtkNotUsed(calldata))
{
MySphereWidget* self = reinterpret_cast<MySphereWidget *>( clientdata );
and implement the constructor:
MySphereWidget::MySphereWidget()
{
this->EventCallbackCommand->SetCallback(MySphereWidget::ProcessEvents);
}
Dean
More information about the vtkusers
mailing list