Re: Cocoa Bindings, NSMatrix, setting programmatically
Re: Cocoa Bindings, NSMatrix, setting programmatically
- Subject: Re: Cocoa Bindings, NSMatrix, setting programmatically
- From: Allan Odgaard <email@hidden>
- Date: Wed, 28 Apr 2004 19:44:32 +0200
On 28. Apr 2004, at 14:46, Renaud Boisjoly wrote:
Let me try another shot at describing the setup...
But no source? :)
I've created an NSArrayController to manage an object which contains
different properties, like an event name, weekdays it should occur on,
hours it should occur on, etc.
An array controller to manage an object? Do you actually mean to manage
an array of objects, and that each object have the properties you
mention?
I've bound the NSMatrix's selectedValues to my NSArrayController using
"selectedObjects" and the value "weekdays".
Is this the same array controller as before? Or do you have one array
controller for all the objects and then another array controller for
the weekdays, which contentArray and/or selectedObjects is bound to a
key path involving the selected object of the first array controller?
But when I set the array programmatically, using [self
setAllWeekdays:[NSMutableArray arrayWithObject:@"Monday"]; the array
is set, but the interface doesn't reflect it.
Above you said you had bound the value to 'weekdays', so changing that
value, assuming it is the same, should be done with the setWeekdays:
accessor or using setValue:forKeyPath: with "weekdays" in the key path.
I also notice that you send the method to 'self', does that mean that
it is the object itself which sets a default weekday array? is this
object created by the array controller?
Am I wrong in assuming the content of this array is a simple NSString?
Must I use a reference to the NSCell itself (where am I going to get
that, through an outlet perhaps?
I am still not sure exactly how you hookup things, but I am sure that
you would not have to use NSCell instances -- I am almost certain that
a string array is the proper thing if I understand you correctly.
Sorry, I'm a newbie at all this, thanks for all your help! Let me know
if this isn't clearer...
The best way is really to a) describe the task that needs to be solved
in an as abstract way as possible (so to avoid all those details which
generally needs a diagram to explain and/or leads to misunderstandings
;) ) and b) provide source code (but trying to limit it to only the
essential parts, i.e. 5-15 lines)!
_______________________________________________
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.