Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?
Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?
- Subject: Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?
- From: Matt Neuburg <email@hidden>
- Date: Sun, 31 Jan 2010 19:03:22 -0800
- Thread-topic: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?
On Fri, 29 Jan 2010 22:52:34 -0800, Jerry Krinock <email@hidden> said:
>[this1]
>This clearly states, twice, that ind:toObject:withKeyPath:options: creates
something which is bidirectional.
>[this2]
>This tells me that, "as a minimum", a binding is only unidirectional.
>
>How do you know when a binding is going to be unidirectional or bidirectional
There's a common misconception here, and I see a lot of nonsense written
about it, to which I with difficulty restrain myself from responding. It's
all very simple.
(1) There is no such thing as a bidirectional binding; all bindings are
unidirectional. If you want a bidirectional binding, set up two bindings so
that you bind in both directions (there is nothing wrong with this, the
computer doesn't explode or anything like that).
(2) But some objects, most notably built-in interface objects, when they are
told to bind, also set up KVO so that information runs back the other way.
You can emulate this in your own interface objects, and mmalc has a
wonderful example that shows you how to do it (and, by implication, shows
you how the built-in interface objects are doing it).
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
_______________________________________________
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