• 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: small notes on enabling of menus in a modal window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: small notes on enabling of menus in a modal window


  • Subject: Re: small notes on enabling of menus in a modal window
  • From: Steven Kramer <email@hidden>
  • Date: Sat, 9 Oct 2004 15:39:05 +0200


Op 7-okt-04 om 19:33 heeft Matt Neuburg het volgende geschreven:

The enabling of menus when a modal window is active can cause confusion and
is not well explained in the documentation.


* Alternatively, a menu item can have a specific non-nil target. In this
case the only place we look is in that target. If it doesn't implement the
action method, the menu item is disabled. If it does, then we look to see if
validateMenuItem: is implemented and the rules are as before.

However, this does not work when the frontmost window is modal. There are
various workarounds, but the simplest is to implement worksWhenModal in the
target class. The problem and the solution are undocumented; I learned about
this use of worksWhenModal in a note from Sascha Matzke:

<http://cocoa.mamasam.com/COCOADEV/2003/01/2/54991.php>


That is rather brilliant. I have now resorted to connecting my items to First Responder and manually inserting my controller in the responder chain (where it really doesn't want to be). Today, in fact, after running into this problem again and half forgetting I'd fixed it this way a few weeks ago (in the same class ;-). I'll try the workswhenmodal route too, looks cleaner.

Regards,

Steven

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >small notes on enabling of menus in a modal window (From: Matt Neuburg <email@hidden>)

  • Prev by Date: RE: Open a file package
  • Next by Date: Re: triggerChangeNotificationsForDependentKey in subclass of NSArrayController
  • Previous by thread: Re: small notes on enabling of menus in a modal window
  • Next by thread: Memory management and Objects.(Newbie)
  • Index(es):
    • Date
    • Thread