Re: NSArrayController, add:, default values
Re: NSArrayController, add:, default values
- Subject: Re: NSArrayController, add:, default values
- From: Chad Seldomridge <email@hidden>
- Date: Mon, 11 Dec 2006 12:30:22 -0700
If your NSArrayController is controlling an Entity (as in a Core Data
Application) then you can set the entity attribute default values in
the data model editor.
If you are not using Core Data, then your NSArrayController is
probably backed with NSMutableDictionary objects (the default). I'm
not sure if there is a spiffy way to set default values in a GUI.
What you need to do is have the NSArrayController use a custom class
of your own design. This can be changed in the Attributes section of
the inspector under the field "Object Class Name".
Your own custom class can be an NSObject with attribute accessors
that are KVC/KVO compliant, or you can subclass NSMutableDictionary
and not bother with accessor methods. In either case, set your
default values in init.
Chad
Message: 14
Date: Mon, 11 Dec 2006 18:55:00 +0100
From: Martin <email@hidden>
Subject: NSArrayController, add:, default values
To: Cocoa Dev <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Hi,
I've got a NSTableView whose columns are bound to a
NSArrayController. I've also got a NSButton whose action is connected
to the NSArrayController's add: method so that when I click on that
button a new row automagically appears and I just have to enter the
values in the NSTableView's fields.
How can I set default values for the columns ? Because when I add a
new row, the row is blank (ie filled with NULL values). The "NULL
placeholder" is not fine enough for me : it's just a GUI replacement
for the NULL value ; what I want is fill that row with real default
values.
Is there a way to do it non-programmatically ?
Thanks,
Martin.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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