[vtkusers] Question for C++ Gurus!

vidyadhar vidyadhar at lucidindia.net
Thu Mar 23 22:42:00 EST 2006


Hi,
You can use SetClientData method of vtkCallbackCommand and give it reference
to your class instance. This reference comes back in the static method which
you can typecast and use.
HTH
----- Original Message -----
From: "Jessica Weiner" <suspended at gmail.com>
To: <vtkusers at vtk.org>
Sent: Wednesday, March 22, 2006 10:15 PM
Subject: [vtkusers] Question for C++ Gurus!


> I am capturing left mouse click events in my vtk scene. Whenever the left
> mouse button is released I want to change the vtk scene somehow. My event
> handler method (myKeyPressCallback) is a static method and therefor it
does
> not have access to the variables of the class it belongs to. I would like
to
> have a pointer to the parent class (CSdiogl2View) inside the event handler
> which has all the actors. How can this be done? I have written my code
like
> this:
>
>
> vtkCallbackCommand * keypressCB = vtkCallbackCommand::New();
>  keypressCB->SetCallback(&CSdiogl2View::myKeyPressCallback);
>
> style = vtkInteractorStyleTrackballActor::New();
> style->AddObserver(vtkCommand::LeftButtonReleaseEvent,keypressCB);
> iren->SetInteractorStyle(style);
>
> Thanks.
> Jess
>
>
>




More information about the vtkusers mailing list