[vtkusers] How to delete a custom callback in vtkInteractorStyleUser

Sven sprevrha at yahoo.de
Wed Nov 13 06:07:28 EST 2002


I'd like to use my custom callbacks sometimes, but then I'd like to be
able to switch back to the default vtkInteractorStyleSwitch behavior.
How do I do that? I use the vtkInteractorStyleUser like below. It seems
the AddObserver method would not change the default observer, but it
does. 
 
  vtkInteractorStyleUser *isu = vtkInteractorStyleUser::New();
 
  // Method 1
  isu->SetLeftButtonPressMethod(&LBCallback, (void *)isu);
 
  // or Method 2
  // Here is where we setup the observer, we do a new and delete after
  // tying it to the callback for correct reference counting
  myCallback *mcb = myCallback::New();
  isu->AddObserver(vtkCommand::LeftButtonReleaseEvent,mcb);
  mcb->Delete();
 
  
  vtkRenderer *ren1 = vtkRenderer::New();
  vtkRenderWindow *renWin = vtkRenderWindow::New();
  renWin->AddRenderer(ren1);
  vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
  iren->SetRenderWindow(renWin);
  iren->SetInteractorStyle(isu);
 
Sven
 
May all beings know the ease of living.
May all beings live in peace.
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20021113/a8518a0a/attachment.htm>


More information about the vtkusers mailing list