[vtk-developers] Catching member events in OO style

pat marion pat.marion at kitware.com
Wed Sep 22 08:50:27 EDT 2010


Take a look at Servers/Filters/vtkMemberFunctionCommand.h in the paraview
source directory.

Pat

On Wed, Sep 22, 2010 at 8:36 AM, David Doria <daviddoria at gmail.com> wrote:

> As an example, say I have a vtkImageTracerWidget as a member variable
> of a subclass of vtkInteractorStyle. To catch the widgets events in a
> way that I still have access to the class instance data, I have
> declared a static callback function
>
> class MyClass : public vtkInteractoStyle
> {
>  public:
>   static void KeypressCallbackFunction ( vtkObject* caller,  long
>     unsigned int eventId, void* clientData, void* callData );
>
> When I set up the vtkCallbackCommand, I used SetClientData(this) to
> give the callback access to my interactor style. Unfortunately this is
> only public access. This seems like a horribly convoluted way to
> catching these events - is there a more OO-friendly way?
>
> Thanks,
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20100922/0800359b/attachment.html>


More information about the vtk-developers mailing list