[Pythonmac-SIG] Posting KeyDown events to NSResponder instances?

Steve Spicklemire steve at spvi.com
Wed Jul 20 08:39:08 CEST 2005


Hi Folks,

I'm guessing this is supposed to be easy.. but I've spend a good  
chunk of time searching for an approach, but none of the suggestions  
I've found is working for me. ;-( I need to 'manually' send a keyDown  
event (left arrow actually) to a QTMovieView instance. The movie view  
is in a window that's an objective-c subclass of NSWindow. The window  
controller is a pyObjC instance. Is there an easy way to do this? The  
NSEvent constructor for 'keyEvents' is a bit overwhelming,  
nonetheless.. I managed to get it working from my objective-c  
NSWindow subclass instance.. but no matter how I try to post the  
keyDown it never behaves the same as actually hitting the keyboard  
when the QTMovieView has focus. In fact.. it seems that when I call  
qtView.keyDown_(event) from the window controller the event is  
ignored by the qtView and passed on tp the window's keyDown:, but  
when I hit a real key... the even is 'swallowed' by the view and the  
window never sees it. There something about the responder chain I'm  
not getting here!

Any thoughts are welcome.

thanks,
-steve



More information about the Pythonmac-SIG mailing list