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

Re: Document-based app: UI item validation


  • Subject: Re: Document-based app: UI item validation
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 21 Aug 2011 11:40:56 -0700

On Aug 21, 2011, at 11:13 , Luc Van Bogaert wrote:

> I have found a way to get what I want using the sharedDocumentController object and the current document's list of windows.
>
> But actually, I'd prefer using 'validateUserInterfaceItems' as you suggest, except that some of the menu items that I want to change, are actually submenu's that don't send a message to my target object. So how would those get validated if they aren't using the target-action mechanism?

So what is the purpose of the submenu items if they don't have an action?

Not that it matters much. The only way to display the submenu is to display the menu item (well, the menu item's menu), so the menu item validation is going to be called first. You can use validation of the menu item to trigger updating of or contextualizing the submenu. That's the ordinary way, too.

I forgot to say in my earlier response:

You probably don't (in general) want to make a window controller the delegate of a *menu*, because this means the window controller is going to need knowledge of the structure of the menus themselves, and that's not desirable -- if you moved an item to a different menu, you'd likely have to change the window controller too. The 'validateUserInterfaceItem:' mechanism divorces the menu item behavior from the menu structure. It also (potentially) integrates validation across menu-bar menus, context menus, popup button menus and toolbar items. It's "really" the action being validated, not the UI representation of the action, if you want to think of it that way.

The example you raised, though, where a submenu changes in response to (say) the document state *is* an example of the window controller needing knowledge of the menu structure (part of it, anyway).


_______________________________________________

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: Document-based app: UI item validation
      • From: Luc Van Bogaert <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>)

  • Prev by Date: Re: Document-based app: UI item validation
  • Next by Date: Re: Document-based app: UI item validation
  • Previous by thread: Re: Document-based app: UI item validation
  • Next by thread: Re: Document-based app: UI item validation
  • Index(es):
    • Date
    • Thread