<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2>Interactor style itself is an observer on
interactor. Observer added to style MAY receive the keypress event AFTER
interactor style has acted on it. So I think it would be better to derive a
class from suitable interactor style and override its virtual functions.
Ignore the EXIT related keys and pass other keys to the base class.</FONT></DIV>
<DIV><FONT face=Arial size=2>HTH</FONT></DIV>
<DIV><FONT face=Arial size=2>Vidyadhar</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=lplavorante@gmail.com href="mailto:lplavorante@gmail.com">Luca
Pallozzi Lavorante</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=vtkusers@vtk.org
href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, March 30, 2007 5:03
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [vtkusers] How to activate
KeyPress EventsinvtkXRenderWindowInteractor?</DIV>
<DIV><BR></DIV>Hi Vidyadhar, thank you for you replay.<BR>Yesterday there has
been another thread of messages dealing with the same question and, again, the
Focus issue has been raised.<BR>I was trying to implement picking using the
īpī key, but then I resolved using mouse events. As to the exit event caused
by the `q` and `e` keys, canīt it be trapped using an observer on the
Interactor?<BR><BR>Thank you<BR><BR> Luca<BR><BR>
<DIV><SPAN class=gmail_quote>On 3/30/07, <B
class=gmail_sendername>vidyadhar</B> <<A
href="mailto:vidyadhar@lucidindia.net">vidyadhar@lucidindia.net</A>>
wrote:</SPAN>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV bgcolor="#ffffff">
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2>I use win32 only so cannot be sure about other
windowing environments. In win32, mouse events go to window under mouse
cursor so render window, standalone or parented to some other window
receives the mouse events. Keyboard events go to that window which has
keyboard focus. This could be dialog window parent of render window or some
deeper nesting (in my case nesting is very deep, using MDI window with user
controls parenting render window). For this reason, keyboard events are
processed in stand alone vtk window but not if it is parented. Some
mechanism has to be set to pass keypress events from container upto render
window interactor. This is tricky and I have not tried it beyond direct
parentage case. A word of caution if you decide to try this event
forwarding. Pressing 'Q', 'q', 'E' and 'e' key which are passed to
interactor can cause the entire application to close down (on win32 the
interactor send quit message to OS).</FONT></DIV>
<DIV><FONT face=Arial size=2>HTH</FONT></DIV><SPAN class=sg>
<DIV><FONT face=Arial size=2>vidyadhar</FONT></DIV></SPAN>
<DIV><SPAN class=e id=q_111a0fa54bdcd362_2>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV
style="FONT: 10pt arial; font-stretch: normal; font-size-adjust: none">-----
Original Message ----- </DIV>
<DIV
style="BACKGROUND: rgb(228,228,228) 0% 50%; FONT: 10pt arial; font-stretch: normal; font-size-adjust: none; moz-background-clip: initial; moz-background-inline-policy: initial; moz-background-origin: initial"><B>From:</B>
<A title=lplavorante@gmail.com
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:lplavorante@gmail.com" target=_blank>Luca Pallozzi
Lavorante</A> </DIV>
<DIV
style="FONT: 10pt arial; font-stretch: normal; font-size-adjust: none"><B>To:</B>
<A title=vtkusers@vtk.org
onclick="return top.js.OpenExtLink(window,event,this)"
href="mailto:vtkusers@vtk.org" target=_blank>vtkusers@vtk.org</A> </DIV>
<DIV
style="FONT: 10pt arial; font-stretch: normal; font-size-adjust: none"><B>Sent:</B>
Thursday, March 29, 2007 3:43 AM</DIV>
<DIV
style="FONT: 10pt arial; font-stretch: normal; font-size-adjust: none"><B>Subject:</B>
[vtkusers] How to activate KeyPress Events
invtkXRenderWindowInteractor?</DIV>
<DIV><BR></DIV>Hi everybody,<BR>I am trying to use a KeyPressEvent in my
application using some test callback. I have followed the procedure listed
below, but when I press a key nothing happens.<BR>Could someone
please tell me if I am missing something?<BR>Thank you very much for your
help.<BR><BR> Luca<BR><BR>Code:
<BR><BR>vtkXRenderWindowInteractor *iren =
vtkXRenderWindowInteractor::New();<BR><BR>vtkCallbackCommand *keyPressCB =
vtkCallbackCommand::New();<BR>
keyPressCB->SetClientData(iren);<BR> keyPressCB->SetCallback
(keyPressCallback); // keyPressCallback is created elsewhere. It
prints a message.<BR> <BR>vtkInteractorStyleTrackballCamera
*styleTrackball = vtkInteractorStyleTrackballCamera::New();<BR>
styleTrackball->AddObserver(vtkCommand::KeyPressEvent,
keyPressCB);<BR><BR>iren->SetInteractorStyle(styleTrackball);
</BLOCKQUOTE></SPAN></DIV></DIV></BLOCKQUOTE></DIV><BR></BLOCKQUOTE></BODY></HTML>