[vtkusers] problem with vtkPlaneWidget

Will Schroeder will.schroeder at kitware.com
Mon Jun 3 07:32:31 EDT 2002


Hi Frederic-

In C++, you create a callback and then use AddObserver() to associate the 
callback with the event like so:

class vtkMyCallback : public vtkCommand
{
public:
   static vtkMyCallback *New()
     { return new vtkMyCallback; }
   void Delete()
     { delete this; }
   virtual void Execute(vtkObject *caller, unsigned long, void*)
     {
       vtkBoxWidget *boxWidget = reinterpret_cast<vtkBoxWidget*>(caller);
       boxWidget->GetTransform(this->Transform);
       this->Actor->SetUserTransform(this->Transform);
     }
   vtkMyCallback():Transform(0),Actor(0) {}
   vtkTransform *Transform;
   vtkActor     *Actor;
};

boxWidget->AddObserver(vtkCommand::InteractionEvent,myCallback);


This example is from Hybrid/Testing/Cxx/BoxWidget.cxx

Will




More information about the vtkusers mailing list