Re: Setting key equivalent for menus depending on window
Re: Setting key equivalent for menus depending on window
- Subject: Re: Setting key equivalent for menus depending on window
- From: Ken Thomases <email@hidden>
- Date: Sun, 20 Oct 2013 14:37:25 -0500
On Oct 20, 2013, at 2:29 PM, Charles Srstka wrote:
> -menuNeedsUpdate: has the same problem that -validateMenuItem: has. It doesn't get called until the menu is about to be actually drawn, which doesn't happen until the user clicks on your menu.
This isn't correct. Menus are updated/validated when resolving keyboard shortcuts. What makes you think otherwise? Lots of things wouldn't work if that weren't so.
> This is inadequate for what the OP wants to do, because he is setting keyboard shortcuts, which are supposed to be used without accessing the menu. If the shortcuts aren't updated until the menu is drawn, the keyboard shortcuts will not work at program start, which is irritating. They could also very easily get out of sync with the interface, if the following sequence of events occurs:
>
> 1. User clicks on the File menu while there are no tabs open. ⌘-W is mapped to Close Window.
>
> 2. User switches to a window that has a bunch of tabs, but never clicks on the File menu, so ⌘-W is still mapped to Close Window.
>
> 3. User hits ⌘-W, intending to close one tab. Surprise! He just closed the whole window instead.
>
> Needless to say, this does not provide a good experience to your users.
Which is why Cocoa doesn't work that way.
Regards,
Ken
_______________________________________________
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