• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: runModalForWindow is disabling my menus
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: runModalForWindow is disabling my menus


  • Subject: Re: runModalForWindow is disabling my menus
  • From: "Pascal J. Bourguignon" <email@hidden>
  • Date: Sat, 05 Sep 2015 15:45:41 +0200
  • Organization: Informatimago



On 05/09/15 14:14, Felipe Monteiro de Carvalho 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!

I tried to forcefully enable them, by implementing validateMenuItem
and returning always true, but it doesn't work.

Each menu item has itself as target and a method to respond to the action.

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?

I have a hard time understanding whats the problem here and why the
menus won't just work.

I searched Google and other people had this problem, but noone solved
it. It seams that few people use modal windows with menus, by the way
as there were not that many discussions about it.
AFAIK, it's on purpose. Definitely in the case of an application modal dialog. In the case of a window modal dialog, you can switch to another window, and then have access to the menubar, but within the context of the window modal dialog, you the menus are disabled.

runModalForWindow makes an application modal dialog.


So I would rather try to use|-[NSWindow beginSheet:completionHandler <https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/#//apple_ref/occ/instm/NSApplication/beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:>].|

Where did you put the validateMenuItem? The object implementing validateMenuItem must be the target of the |/menuItem. /|

--
__Pascal J. Bourguignon__
http://www.informatimago.com/
_______________________________________________

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


  • Follow-Ups:
    • Re: runModalForWindow is disabling my menus
      • From: Felipe Monteiro de Carvalho <email@hidden>
References: 
 >runModalForWindow is disabling my menus (From: Felipe Monteiro de Carvalho <email@hidden>)

  • Prev by Date: Re: Auto Layout Problems
  • Next by Date: Re: Auto Layout Problems
  • Previous by thread: runModalForWindow is disabling my menus
  • Next by thread: Re: runModalForWindow is disabling my menus
  • Index(es):
    • Date
    • Thread