• 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: [SOLVED] Document-based app: UI item validation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SOLVED] Document-based app: UI item validation


  • Subject: Re: [SOLVED] Document-based app: UI item validation
  • From: Luc Van Bogaert <email@hidden>
  • Date: Sun, 21 Aug 2011 23:04:28 +0200

>> My solution was to assign the menu item (the one with the submenu) a dummy action that does nothing. Then I used the normal 'validateUserInterfaceItem:' mechanism to enable or disable the menu item with that action, based on whether all of the submenu items were enabled or not. You could use a similar approach to change the menu title instead of its enable status. It's certainly possible that there's some obscure, unwanted UI behavioral side-effect of doing this, but I haven't seen any.
>
> I've been trying to do this during the last half hour, but without success so far... I'll give it one more go tomorrow.
>
>>
>> For completeness, I'll add that if there's some genuine reason why you couldn't use the 'validateUserInterfaceItem:' mechanism to solve your problem, then the correct solution may well be to use a menu delegate after all. But in that case, I wouldn't use the window controller as the delegate, I'd use a global (singleton) object such as the app delegate instead. That would move you're app's knowledge of the menu structure (which is app-global knowledge more than document-specific knowledge) into an app-global place, and it would properly separate the menu-structuring behavior from the menu-validating behavior.
>
> Using the app-delegate is what I've implemented at this moment, and this works just fine. If the other solution (see above) doesn't work, this is what I'll stick to.
>
>>
>> But unless you're forced into this more invasive approach, I'd suggest you try the dummy action solution.
>>
>
>


OK, I've gotten your solution using a dummy action to work. Thanks!


_______________________________________________

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

References: 
 >Document-based app: UI item validation (From: Luc Van Bogaert <email@hidden>)
 >Re: Document-based app: UI item validation (From: Jerry Krinock <email@hidden>)
 >Re: Document-based app: UI item validation (From: Luc Van Bogaert <email@hidden>)
 >Re: Document-based app: UI item validation (From: Quincey Morris <email@hidden>)
 >Re: Document-based app: UI item validation (From: Luc Van Bogaert <email@hidden>)
 >Re: Document-based app: UI item validation (From: Quincey Morris <email@hidden>)
 >Re: Document-based app: UI item validation (From: Luc Van Bogaert <email@hidden>)
 >Re: Document-based app: UI item validation (From: Quincey Morris <email@hidden>)
 >Re: Document-based app: UI item validation (From: Luc Van Bogaert <email@hidden>)

  • Prev by Date: Re: Document-based app: UI item validation
  • Next by Date: Re: Crash Reporter for Lion
  • Previous by thread: Re: Document-based app: UI item validation
  • Next by thread: Can Peer-to-Peer Model Be Launched in AppStore?
  • Index(es):
    • Date
    • Thread