Re: runModalForWindow is disabling my menus
Re: runModalForWindow is disabling my menus
- Subject: Re: runModalForWindow is disabling my menus
- From: Stephane Sudre <email@hidden>
- Date: Sat, 05 Sep 2015 20:49:59 +0200
On Sat, Sep 5, 2015 at 2:14 PM, Felipe Monteiro de Carvalho
<email@hidden> wrote:
> Hello,
>
> I want to have a modal window which has menus, so I setup the menus
> for the window and make it modal with NSApp.runModalForWindow and
> everything is OK, except that my menu items are all disabled!
Which feature of a modal window are you looking for? Because having
all the menu items being enabled in the case of a modal dialog does
not match the nature of the modal mode (i.e. restricted mode).
> Each menu item has itself as target and a method to respond to the action.
Why not have at least a shared object as the target?
> If I only change from runModalForWindow to a non-modal window show,
> then everything works ok!
>
> Any ideas or is it impossible to have menu items and use runModalForWindow?
It's possible to have (enabled) menu items for a window running as
modal. For instance, if you have a NSWindowController subclass
controlling an empty modal window panel, you can add a - (IBAction)
cut:(id)sender {} method to the controller and the Cut menu item will
become enabled.
_______________________________________________
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