[vtkusers] VtkSphereWidget unable to handle the right or left click...

David Doria daviddoria+vtk at gmail.com
Fri Mar 5 09:16:09 EST 2010


>
>
> 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
>

Hi Dean,

Why would they do this instead of letting you override the On*() functions
as usual?

I tried to do what you suggested:
http://www.vtk.org/Wiki/VTK/Examples/Widgets/SphereWidgetEvents

But I get this error:

error: no matching function for call to
'vtkCallbackCommand::SetCallback(<unresolved overloaded function type>)'
note: candidates are: virtual void vtkCallbackCommand::SetCallback(void
(*)(vtkObject*, long unsigned int, void*, void*))

There should be a matching function because we just defined it, right?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100305/cbd8772f/attachment.htm>


More information about the vtkusers mailing list