Re: KVO and bindings question
Re: KVO and bindings question
- Subject: Re: KVO and bindings question
- From: mmalcolm crawford <email@hidden>
- Date: Fri, 28 May 2004 09:41:19 -0700
On May 28, 2004, at 7:40 AM, Don Rainwater wrote:
Also in the summary, I have some text that is only to be displayed
when the balance is negative. I had originally thought to observe the
balance instance variable in the provider record, but that only
changes during the calculation phase, and not when the user is
reviewing the provider summaries. I then thought I might be able to
observe the text field itself, so I added my controller as an observer
of itself, with the key path set to the IBOutlet for the text field,
but observeValueForKeyPath:... doesn't seem to fire as I flip through
the providers.
Finally, I thought I would define an action for the text field,
thinking that the action would fire when the text field changed values
from selecting different providers. The action doesn't fire, so no
joy there either.
So, with most of the summary display bound to fields in the table
records, how can I conditionally set other fields in the summary?
It's still not clear to me exactly what is bound to what, and what your
goal is.
Is it the case, fundamentally, that something you're displaying should
be dependent on the user's current selection?
If so, then the likelihood is that the display binding should be bound
to [ArrayController].selection.whatever
If the value of 'whatever' is dependent on other values that might
change, then establish that dependency with
'triggerChangeNotificationsForDependentKey:'
<
http://developer.apple.com/documentation/Cocoa/Conceptual/
KeyValueObserving/Concepts/DependentKeys.html>
If the value of 'whatever' is not a boolean and you need it to be, use
-- or implement and use -- a value transformer.
Or it may be that I've completely misunderstood your requirements...
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.