[vtkusers] who 'observes' event?

Amy Henderson amy.henderson at kitware.com
Wed Jun 2 10:49:23 EDT 2004


Hi AJ,

The whole point of using events is that you don't manually invoke them; 
they are indications that something happened. As a VTK user, you write code 
that watches for events and does something when a particular event occurs. 
Add an observer for the KeyPressEvent on the render window interactor 
(Iren, in your code). The event should happen if the render window this 
interactor is used in has focus.

- Amy

At 10:42 AM 6/2/2004, A J wrote:
>..or do I have to make my own InteractorStyle which invokes a keypress 
>event somehow (using openGL functions I guess?)
>I can't really find in the documentation anything that would invoke a 
>KeyPressEvent
>Thanks again!!!!
>
>
>>From: Amy Henderson <amy.henderson at kitware.com>
>>To: vtkusers at vtk.org
>>Subject: Re: [vtkusers] who 'observes' event?
>>Date: Wed, 02 Jun 2004 08:36:20 -0400
>>
>>Hi AJ,
>>
>>The Enter event is not for detecting when the Enter key on the keyboard 
>>is pressed. The Enter event is invoked when the mouse pointer enters the 
>>render window. (There is also a Leave event.) To detect when Enter is 
>>pressed, you probably need to watch vtkCommand::KeyPressEvent and add 
>>code yourself for checking whether the key that was pressed is the Enter key.
>>
>>- Amy
>>
>>At 10:20 PM 6/1/2004, A J wrote:
>>>Hi,
>>>
>>>regarding the problem of my last post - maybe the problem is I haven't 
>>>added an observer to the correct object
>>>
>>>I tried it with
>>>
>>>            RenWin->AddObserver( vtkCommand::EnterEvent, cbc );
>>>and       Ren-> "
>>>and       Iren-> "
>>>
>>>(note that I am calling Iren->Render() to render my scene)
>>>
>>>but none of them seem to detect when I press the Enter key on my keyboard..
>>>
>>>If I change it to detecting Ren->AddObserver( vtkCommand::ModifiedEvent, 
>>>cbc)
>>>Then this works fine
>>>
>>>But thats the only one that I can get to work
>>>Really I would like it to detect when I press Enter!
>>>
>>>So if anyone has any insight.. then please englighten me..! =S
>>>Thank you in advance once again =)
>>>
>>>AJ
>>>
>>>_________________________________________________________________
>>>Looking to buy a house? Get informed with the Home Buying Guide from MSN 
>>>House & Home. http://coldwellbanker.msn.com/
>>>
>>>_______________________________________________
>>>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
>>
>>
>>
>>_______________________________________________
>>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
>
>_________________________________________________________________
>MSN 9 Dial-up Internet Access fights spam and pop-ups ­ now 3 months FREE! 
>http://join.msn.click-url.com/go/onm00200361ave/direct/01/
>
>_______________________________________________
>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