On Oct 19, 2013, at 6:58 AM, Martin Hewitson <martin.hewit...@aei.mpg.de> wrote:
> Main Window with tabs:
>       close (cmd-shift-w)
>       close tab (cmd-w)
> 
> All other windows:
>       close (cmd-w)
>       close tab (inactive, no keyboard shortcut)
> 
> This is pretty much the way things work in Xcode. 
> 
> So, my question is, is there a smart way to do this, or do I need to 
> implement -validateMenuItem: on every window in the app and set the keyboard 
> shortcuts there?

Untested idea: implement windowDidBecomeKey: and windowDidResignKey: in the 
delegate of the window that has tabs and do the switching of shortcuts there.

If you want to be extra careful you could have two ivars that remember what the 
shortcuts were before you changed them to cmd-shift-w and cmd-w.  Then in 
windowDidResignKey: plug those shortcuts in rather than hard-code cmd-w and @"".

--Andy


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to