• 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: Kludges when binding to 'value' of Menu Items
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Kludges when binding to 'value' of Menu Items


  • Subject: Re: Kludges when binding to 'value' of Menu Items
  • From: "I. Savant" <email@hidden>
  • Date: Tue, 16 Oct 2007 09:37:49 -0400

> Issue #1...
>
> My main menu has an item which reflects a boolean value (checkmark),
> bound to an attribute of the frontmost document via my document
> controller.  However, invoking will/did change was complicated
> because, besides observing changes in this document attribute, I also
> have to observe for possible changes in the frontmost document
> itself, and I can't find any "willChange" notification for the latter.

  You can always bind to File's Owner (NSApplication) with the keypath
of "mainWindow.windowController.document.myBooleanKey" ...


> Issue #2...
>
> Besides the above problem, there's also the issue that menu items
> need a dummy "target" to ever be enabled, even if their action is
> accomplished via bindings.  So I wire all their targets to this...

  I'm not sure if I fully understand you, but you can connect the menu
item to First Responder ... that will give you *a* target and
depending on your app, it could be the frontmost document (or a text
view selected therein). You need to read up on the responder chain for
more details.

  If that's *not* what you meant, can you rephrase?

--
I.S.
_______________________________________________

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: Kludges when binding to 'value' of Menu Items
      • From: Jerry Krinock <email@hidden>
References: 
 >Kludges when binding to 'value' of Menu Items (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Question about laterDate: and earlierDate:
  • Next by Date: Re: Question about laterDate: and earlierDate:
  • Previous by thread: Kludges when binding to 'value' of Menu Items
  • Next by thread: Re: Kludges when binding to 'value' of Menu Items
  • Index(es):
    • Date
    • Thread