Re: Updating bound controls with selection change
Re: Updating bound controls with selection change
- Subject: Re: Updating bound controls with selection change
- From: mmalc crawford <email@hidden>
- Date: Wed, 22 Aug 2007 09:03:28 -0700
On Aug 22, 2007, at 5:41 AM, Ari Benzane wrote:
I have an inspector panel with a host of controls bound to the
values of the currently 'selected' object in the document. Only one
object can be selected at a time. When the selection changes, I want
the bound controls to reflect the new selection, but they don't get
notified because I'm not calling the KVO accessors.
Well, there's the problem...
How are you determining what is the current selection?
What are the bindings for the controls?
What other examples have you looked at and compared with?
Currently I've got code like this that's called when the selection
changes:
[SelectedObject setValueA: [SelectedObject valueA]];
[SelectedObject setValueB: [SelectedObject valueB]];
By convention, names of instances of classes start with a lowercase
letter; class names begin with an uppercase letter.
This updates the controls in a round-about way but it's a mess. Is
they're an easier way? I've read Apple's Bindings and KVO docs but
they only cover the simple cases.
In essence, every case is simple. You need a suitable key path and
you need to ensure that KVO notifications are emitted when a change is
effected.
mmalc
_______________________________________________
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