Re: Help to understand how do events work
Re: Help to understand how do events work
- Subject: Re: Help to understand how do events work
- From: eveningnick eveningnick <email@hidden>
- Date: Thu, 7 Oct 2010 09:00:33 +0400
I'm sorry, i guess i have posted the messages privately before,
thinking they are posted to a mailing list. I have used before only
forums and don't have enough experience with mailing lists :) Hope
this time the message will come to the right destination
Hi Jonathan
Unfortunately this doesn't work.. sendEvent is called only when i
click with the mouse on the window. Keydowns are not dispatched to
this method.
I am just wondering, what path does the event take to get to the
destination control, bypassing somehow the window. I am sure this
happens because of the styles i have specified ( 1) when you click on
a window, the application doesn't become active; 2) the window is
floating on top of all other windows, even if it's not active -
NSPopupMenuWindowLevel), but i haven't found any details about event
routing in this case..
maybe i could do that by reimplementing the main event loop? Or maybe
cocoa framework doesn't send keydowns to my application at all?
What is the general conditional for the application to receive keydown
events? What if the application doesnt have ordinary key windows? is
there still a chance to process such keyDown events on some low level?
> Is you window the key window? call NSWindow - makeKeyWindow
> Regards
yes, for displaying that window i am calling makeKeyAndOrderFront,
making it key window. I am not sure if it becomes key though. As i
have described, my window is "special" - it doesn't behave like most
other cocoa windows. It is situated on the "menu level" (it behaves
like menu?)
>most events coming into an application make their way to a window in a sendEvent: message
unfortunately, keyDown doesn't come (maybe because the window is not
really a "key" one, despite i'm calling makeKeyAndOrderFront).
I am only trying to understand where can i (and whether can i) catch
the key event. According to that "events programming guide", all
events directed to my application come through Main event loop. Thus
i could inject some code into my app's runloop and try to extract the
events from there (if they, as we see, don't reach the window's
-sendEvent)? I don't know how to do that though. What comes on my mind
- is installing eventTap to my own application... But that looks a
little like an overhead.
Do keyDowns come only to those applications which have a keyWindow
displayed on a screen? What if my application is active (i clicked its
icon on dock), but its window is not a key one? The application's
runloop won't get any key down messages? How do popup menus usually
process keydown events? are they also "key windows" in cocoa
terminology?
Thanks again
George
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden