[vtkusers] KeyPress Events / Callbacks / User Interaction
    Sebastian Gatzka 
    sebastian.gatzka at stud.tu-darmstadt.de
       
    Mon Mar 15 08:57:41 EDT 2010
    
    
  
Somthing like this? I'm not getting it ...
class KeyPressInteractorStyle : public vtkInteractorStyleTrackballCamera
{
   public:
     static KeyPressInteractorStyle* New();
vtkImplicitPlaneWidget2 *planeWidget;
     virtual void OnKeyPress()
     {
       //get the keypress
       vtkRenderWindowInteractor *rwi = this->Interactor;
       std::string key = rwi->GetKeySym();
       if (key.compare("p") == 0)
       {
           vtkImplicitPlaneRepresentation* rep = 
*planeWidget*->GetRepresentation();
           rep->SetNormal(1,0,0);
           planeWidget->SetRepresentation(rep);
       }
       //handle an arrow key
       if(key.compare("Up") == 0)
         {
         cout << "The up arrow was pressed." << endl;
         }
       // forward events
       vtkInteractorStyleTrackballCamera::OnKeyPress();
     }
};
*This leads to problems: The planeWidget inside the {}-brackets is unknown.*
Am 15.03.2010 13:48, schrieb David Doria:
> On Mon, Mar 15, 2010 at 8:21 AM, Sebastian Gatzka 
> <sebastian.gatzka at stud.tu-darmstadt.de 
> <mailto:sebastian.gatzka at stud.tu-darmstadt.de>> wrote:
>
>     Ok, and WHERE do I have to set this planeRepresentation member
>     variabel like you suggested?
>
>
> planeRepresentation would be a member of the interactor style 
> subclass. You would set it from wherever you define the 
> vtkPlaneRepresentation and the interactor style subclass.
>
> Thanks,
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100315/2afbbe71/attachment.htm>
    
    
More information about the vtkusers
mailing list