Re: newbie : cocoa bindings - dot separated key path question
Re: newbie : cocoa bindings - dot separated key path question
- Subject: Re: newbie : cocoa bindings - dot separated key path question
- From: Matt Neuburg <email@hidden>
- Date: Wed, 16 Aug 2006 09:51:19 -0700
- Thread-topic: newbie : cocoa bindings - dot separated key path question
On Mon, 14 Aug 2006 14:51:30 -0700 (PDT), joe OneNinetyTwo
<email@hidden> said:
>I have a model object called DataSet in MyDocument
>class that is a composite of two NSMutable arrays
>
>@interface DataSet : NSObject {
> NSMutableArray *data;
> NSMutableArray *dimensions;
>}
>
>The data array holds Datum objects
>@interface Datum : NSObject {
> float real;
> float imaginary;
>}
>and the dimensions array holds dimension objects
>@interface Dimension : NSObject <NSCoding, NSCopying>
>{
> unsigned npts;
> double dwellTime;
> double initialTime;
> double centerFrequency;
>}
>
>I've created two TableViews in the window in
>MyDocument.nib, one for data and one for dimensions.
>I have two NSArrayControllers in the nib called
>DataController and DimensionsController. Can I bind
>my model objects to the controllers using dot
>separated key paths like dimension.npts and
>datum.real, or am I going about this all wrong.
You do not want to bind your model objects to the controllers; you want to
bind the controllers to MyDocument (because that is where the DataSet model
object is) or to an instance of DataSet that is instantiated in the nib. If
the former, the key paths must include the path to the DataSet model object
(at the start). Everything you do must be KVC / KVO compliant so that the
controllers can see the changes.
>I originally had the two arrays data and dimensions
>inside MyDocument, and everything (tableview and
>bindings) was working fine. It's only after I put
>them inside the DataSet Object that I'm having
>problems geting it working again.
If you want specific help, say specifically what you did and specifically
what the "problems" are. 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.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden