• 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: Give a menu keyboard focus – in code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Give a menu keyboard focus – in code


  • Subject: Re: Give a menu keyboard focus – in code
  • From: Andy Lee <email@hidden>
  • Date: Mon, 10 Oct 2011 14:22:27 -0400

Sounds great, Jerry. Thanks for sharing the details of your approach.

--Andy

On Oct 10, 2011, at 2:10 PM, Jerry Krinock wrote:

>
> On 2011 Oct 10, at 02:57, Andy Lee wrote:
>
>> Accessorizer's "Action Menu" is a status item that provides the exact UI Jerry is talking about
>
> Thank you, Andy.
>
> After thinking about what Kevin Callahan has done with Accessorizer, and the suggestion by Graham and Seth, I have an answer that's even better than what I was looking for.
>
> Like Kevin's Accessorizer, which is a utility for Xcode, my app is a bookmarking utility which, among other things, grabs sites from web browsers.  Users want it to be accessible via a global keyboard shortcut while other apps are active.  My original idea was to make this shortcut activate my app's Status Item or Dock Menu.  But now I realize that, thanks to -[NSMenu popUpMenuPositioningItem:atLocation:inView:] which was introduced in 10.6, I don't need the damned Status Item or Dock Menu.  This is great, because the same anti-mouse keyboard-aholic power users who want the global keyboard shortcuts are generally the same users that hate Status Items and hate the Dock.
>
> So all I do is InstallApplicationEventHandler(), and RegisterEventHotKey() with the user's preferred keyboard shortcut.  My handler invokes this 3-line method which is implemented in the NSMenu subclass which I use for my Status Item and Dock Menu…
>
> - (void)popUpAnywhereMenu {
>    NSPoint mouseLocation = [NSEvent mouseLocation] ;
>    [self popUpMenuPositioningItem:[[self itemArray] objectAtIndex:0]
>                        atLocation:mouseLocation
>                            inView:nil] ;
> }
>
> Hit the keyboard shortcut while in any web browser, and Poof!  My app's menu appears, with keyboard focus, at the current mouse location on the screen.
>
> I'll leave my Status Item Dock Menu as a preference option for the mouse fans.  But I'm also keeping my Bug 10122120 open, because it's stupid that the F8 shortcut can't access non-Apple Status Items.  We can't all be as smart (or hacky as Charles suspects) as the bjango guys are.
>
> _______________________________________________
>
> 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

_______________________________________________

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: 
 >Give a menu keyboard focus - in code (From: Jerry Krinock <email@hidden>)
 >Re: Give a menu keyboard focus - in code (From: Jerry Krinock <email@hidden>)
 >Re: Give a menu keyboard focus - in code (From: Jerry Krinock <email@hidden>)
 >Screen Coordinates of Menu. Use CTM? (was: Give menu keyboard focus) (From: Jerry Krinock <email@hidden>)
 >Re: Screen Coordinates of Menu. Use CTM? (was: Give menu keyboard focus) (From: Graham Cox <email@hidden>)
 >Give a menu keyboard focus – in code (From: Jerry Krinock <email@hidden>)
 >Re: Give a menu keyboard focus – in code (From: John Joyce <email@hidden>)
 >Re: Give a menu keyboard focus – in code (From: Jerry Krinock <email@hidden>)
 >Re: Give a menu keyboard focus – in code (From: Andy Lee <email@hidden>)
 >Re: Give a menu keyboard focus – in code (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Give a menu keyboard focus – in code
  • Next by Date: Re: Give a menu keyboard focus – in code
  • Previous by thread: Re: Give a menu keyboard focus – in code
  • Next by thread: NSComboBoxCell & AutoComplete
  • Index(es):
    • Date
    • Thread