On 22.12.2009, at 02:35, Peter Ammon wrote: > To get Carbon's notion of the focus, you can do this: > > HIViewRef focusedView = NULL; > HIViewGetFocus(GetUserFocusWindow(), &focusedView, NULL); > > To get Cocoa's notion, you would write: > > NSResponder *fr = [[NSApp keyWindow] firstResponder] > > The question of "who really has the focus" is a little complicated, because > it depends on who is dispatching events. If you have a Carbon window in a > Cocoa app, HIViewGetFocus() will normally give you a NULL view if a Cocoa > window is focused, so you might start by checking with Carbon, and then > checking with Cocoa if the Carbon focus is not a text field.
Thank you! That seems to work pretty well. Now I only have to figure out a way to nicely disable the shortcut. Of course, I could remove it from the menu item, but it would be a little confusing to users if they don't see the shortcut.I'd be open for any suggestions. Cheers, -- Uli Kusterer "The witnesses of TeachText are everywhere..." _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com