[vtkusers] Question for C++ Gurus!
Michael Knopke
Michael.Knopke at gmx.de
Wed Mar 22 13:18:12 EST 2006
If you just want to have access to only one object of that class you can
give a pointer to this object to your callback
vtkCallbackCommand * keypressCB = vtkCallbackCommand::New();
keypressCB->SetCallback(&CSdiogl2View::myKeyPressCallback);
style = vtkInteractorStyleTrackballActor::New();
style->AddObserver(vtkCommand::LeftButtonReleaseEvent,keypressCB);
style->SetClientData(myObject);
iren->SetInteractorStyle(style);
void CSdiogl2View::myKeyPressCallback(vtkObject* obj, unsigned long eventId, void * clientdata, void * calldata)
{
MyClass* self = reinterpret_cast<MyClass *>( clientdata );
self->DoSomething;
}
but maybe I misunderstand the context...
You can also subclass vtkCommand.
Michael
More information about the vtkusers
mailing list