• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Menu shortcuts without modifiers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Menu shortcuts without modifiers?


  • Subject: Re: Menu shortcuts without modifiers?
  • From: Uli Kusterer <email@hidden>
  • Date: Tue, 22 Dec 2009 15:37:06 +0100

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 (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

References: 
 >Re: Menu shortcuts without modifiers? (From: Peter Ammon <email@hidden>)

  • Prev by Date: __CFServiceControllerBeginPBSLoadForLocalizations timed out
  • Next by Date: Re: UIImage and shadows, WAS: Re: Please if some one knows
  • Previous by thread: Re: Menu shortcuts without modifiers?
  • Next by thread: Persistent NSOperation?
  • Index(es):
    • Date
    • Thread