Re: Disable (grey out) main menu when displaying modal window?
Re: Disable (grey out) main menu when displaying modal window?
- Subject: Re: Disable (grey out) main menu when displaying modal window?
- From: Darren Wheatley <email@hidden>
- Date: Tue, 25 Jan 2011 12:14:06 +0000
- Thread-topic: Disable (grey out) main menu when displaying modal window?
Hi,
The answer is to implement the NSUserInterfaceValidations protocol.
The one method I needed to implement was:
- (BOOL)valildateUserInterfaceItem:
Returning NO disables the referenced menu item.
All works fine now.
Darren.
On 25/01/2011 08:45, "Darren Wheatley" <email@hidden>
wrote:
>Hi,
>
>I load a custom file import window in my Cocoa app using:
>
>[NSApp runModalForWindow:window];
>
>The window displays just fine, and is modal.
>
>However, the application main menu is still active (e.g. File menu and
>items), which is making the modal display redundant.
>
>I've googled this and searched the docs, but can't find a way to turn the
>menu off.
>
>Someone suggested using this:
>
>NSModalSession session = [NSApp beginModalSessionForWindow:window];
>[NSApp runModalSession];
>
>- but that doesn't seem to work either. Again, the window displays but the
>main menu is still active.
>
>Can anyone suggest how I turn the main menu off (grey out all menu items)
>when displaying a modal window please?
>
>Thanks
>
>Darren.
>
>
>_______________________________________________
>
>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:
>.co.uk
>
>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