> On Oct 20, 2013, at 7:21 AM, Martin Hewitson <martin.hewit...@aei.mpg.de> 
> wrote:
> 
> 
>> On 20 Oct 2013, at 01:15 am, Kyle Sluder <k...@ksluder.com> wrote:
>> 
>> Rather than rely on intercepting responder chain-based validation, wouldn't 
>> it be much easier and more reliable to make some object the delegate of all 
>> of your NSMenus and implement -menuNeedsUpdate:?
> 
> But wouldn’t this object then need to know details about the different 
> windows which are presented in the app in order to decide which shortcut key 
> to set?

That's why in my later proposal (using notifications rather than delegation or 
responder-chain stuff) I added category methods to NSWindow, with default 
behavior that you can override in the window that contains tabs.  The app 
delegate does know about the category methods, but it just sends messages to 
windows, it doesn't have any knowledge of what shortcuts are appropriate for 
which window.  Rather, each window knows its own shortcuts.

> I have the feeling that the tabbed window (or its delegate) is the place to 
> make changes to the default menu configuration. I think I will try updating 
> the menu in the windowDidBecomeKey/windowDidResignKey calls of the window’s 
> delegate.

I see by your follow-up that it seems to work, so I'm just tossing out my 
additional two cents here.

> The thing I don’t like about this is that the delegate (my document subclass) 
> now needs to have a link to the menu items which are created in the main menu 
> nib.

That is another reason I like my later proposal.  The app delegate is in 
MainMenu.nib, so you can create outlets from it directly to the menu items.

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