[vtkusers] Question for C++ Gurus!

Jessica Weiner suspended at gmail.com
Wed Mar 22 11:45:05 EST 2006


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