[vtkusers] Selecting a key for a key press event

Dominik Szczerba domi at vision.ee.ethz.ch
Wed Jan 3 17:33:04 EST 2007


I use GetKeySym()
--DS

Ricardo Seco VTK wrote:
> Hello! I want to do a specific event when I press d key. How can I do
> this? I've tried but the key call back runs whatever the key I press...
> Thanks and here is the code of the callback...
> 
> class vtkKeybCallback : public vtkCommand
> {
> public:
>        static vtkKeybCallback *New() { return new vtkKeybCallback; }
>        void SetOriginalList(vtkIdList* pvtkIdOriginal) {
> m_pvtkIdOriginal = pvtkIdOriginal; };
>        void SetDeleteList(vtkIdList* pvtkIdDeletion) { m_pvtkIdDeletion
> = pvtkIdDeletion; };
>        void SetIren(vtkRenderWindowInteractor* pvtkIren) { m_pvtkIren =
> pvtkIren; };
>        virtual void Execute(vtkObject *caller, unsigned long, void*)
>        {
>            char key = 'd';
>            if((m_pvtkIren->GetKeyCode())==key);
>                printf("key callback\n");
>        }
> 
> private:
>    vtkIdList* m_pvtkIdOriginal;
>    vtkIdList* m_pvtkIdDeletion;
>    vtkRenderWindowInteractor* m_pvtkIren;
> };
> 
> Ricardo Seco
> _______________________________________________
> This is the private VTK discussion list. Please keep messages on-topic.
> Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list