[vtkusers] vtkCanvas keyPress events
Jeff Lee
jeff at cdnorthamerica.com
Tue Sep 30 13:32:09 EDT 2003
in short, you could override the behavior of the existing keylistener
something like
public void keyPressed(KeyEvent e) {
char keyChar = e.getKeyChar();
if ('.' == keyChar)
{
doMyNeatThing();
return;
}
... rest of default implementation in vtkCanvas.keyPressed()...
}
long term solution would be to add a user method so you can just
register a pair<char, action>. I can put something like this in the
code, but I really meant vtkCanvas/vtkPanel to be more of an example
than something used for production code - mainly because I haven't heard
of armies of developers using it. Also because there are too many
things going on inside of vtkPanel/Canvas that really should be busted
out into other classes - more of a toolkit.
-J
Christopher M. Navarro wrote:
>I am trying to override some of the default renderwindowinteractor events
>and I'm not sure how I can do this. What I want to do is use the 'p'
>character to turn picking on/off in my scene but there is some control
>built in that has p linked with outlining whatever actor the mouse is
>over. At least that appears to be how it works. This interaction is
>controlled by lines 241/242 of vtkCanvas.java where KeyPressEvent() and
>CharEvent() are called on the generic renderwindow interactor. If I
>comment them out, I get the result I want. However, this solution isn't
>desirable since I lose all of the rest of the default keyevents. Any
>ideas on how I can accomplish this?
>
>regards,
>
>chris
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>
>
More information about the vtkusers
mailing list