[vtkusers] Selecting a key for a key press event

Ricardo Seco VTK secolasUA at gmail.com
Wed Jan 3 11:58:46 EST 2007


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



More information about the vtkusers mailing list