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:41:53 -0700
On Aug 22, 2007, at 9:28 AM, Ari Benzane wrote:
mmalc crawford <email@hidden> wrote:
On Aug 22, 2007, at 5:41 AM, Ari Benzane wrote:
How are you determining what is the current selection?
I have an NSController object in the NIB bound to the setSelection
method in my document which is working ok.
Do you mean, you have an instance of NSController whose Content Object
is bound to the the 'selection' in the document?
In what sense is this working "OK"?
What are the bindings for the controls?
Numbers mostly.
Umm, no... how have you bound the controls? Please give an example
binding.
Thats working fine, privided I call the relevent accessors.
So you're only seeing problems if you don't call the relevant
accessors? This would be expected behaviour...
What other examples have you looked at and compared with?
Lots! But I've not seen anything quite like my project. I'm only
partially using bindings (ie. all my tables use datasources etc).
This should not be relevant. It's perfectly fine to mix bindings and
"traditional technologies".
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.
Yes I know. This was pseudo code.
??!
If you follow the conventions, even in pseudo-code, it makes it easier
for others to follow your code.
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.
So how can I ensure said notifications are displatched when the
NSController object changes with the selection?
In general, you simply need to invoke KVO-compliant accessor methods...
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