[vtkusers] Handling Arrow Keys In vtkRenderWindow in .NET Forms

Bakul bakul at lucidindia.com
Wed Dec 16 00:32:07 EST 2009


Hello,

I am a new user to vtk, and i am facing problem in handling arrow keys.

I am using vtkRenderWindow whose parent is set as a panel, this panel  is
into a "user control" named ViewerControl which is in a form, now for the
vtkRenderWindowInteractor i am listening to the "key press events"  I am
getting the event for each key press except the "Arrow keys and the TAB
key". The keys are not at all captured by the vtkRenderWindow (because when
i press these arrow keys the event goes to the main form and its used to
navigation on different controls there), further digging i came across for a
user control to process these keys one should override a virtual method
called IsInputKey(Keys keyData). which i have done as follows.

      bool ViewerControl::IsInputKey(Keys keyData)
      {
        switch (keyData)
        {
        case Keys::Left:
        case Keys::Right:
        case Keys::Up:
        case Keys::Down:
        case Keys::Tab:
          return true;
        }
        return __super::IsInputKey(keyData);
      }

but this is not a solution am looking for. When my focus is on the
ViewerControl then the arrow keys are processed but then all other input
keys are also captured by it and vtkRenderWindow doesn't get any key, to
make vtkRenderWindow to capture keys i need to click on it.

I may be proceeding fully towards wrong direction and i need help on this.
Is there is any way to make vtkRenderwindow to make listen these arrow keys.

Thanks In Advance,
Vakul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091216/fdc87fa4/attachment.htm>


More information about the vtkusers mailing list