Re: Handling a menu item in a modal dialog


James Walker
 

On 8/13/18 5:04 PM, Bill Pitcher wrote:
Not sure it is possible, modal means just the controls on sheet are actioned. Normally if you’re in a sheet and you want the App to Quit you add a Button that Quits. I think you can give the button the Command-Q short cut.

If the sheet isn’t fully modal then maybe you’re better coming from the other direction and displaying it non-modally and ensuring the menu options that don’t apply are disabled. YMMV.

It's not a sheet, just a window being operated with -[NSApplication runModalForWindow:].

On 14/08/2018, at 11:51 AM, James Walker <list2@...> wrote:

I'm trying to enable the Quit menu item while a modal dialog is running, is that possible?  My window controller implements the terminate: action, and has a validateMenuItem: method, but validateMenuItem: never gets called.  The window is main and key, and the only thing preceding the window controller in the responder chain is the window itself, which does not respond to a "terminate:" message.  I've checked that [NSApp targetForAction: @selector(terminate:)] returns my window controller.  What might I be missing?


Join cocoa@apple-dev.groups.io to automatically receive all group messages.