Generating default values in a bindings controlled Tableview
Generating default values in a bindings controlled Tableview
- Subject: Generating default values in a bindings controlled Tableview
- From: Richard Stacpoole <email@hidden>
- Date: Sat, 16 Apr 2005 00:03:10 +1000
Hi,
I have a bindings controlled Tableview, and the specification I am
working to call for some default values to be already entered when a
new record is created (not a placeholder but actual data). My model
contains these:
@interface TaskItem : NSObject {
NSDate *dueDate;
NSString *details;
.....
}
and my set* Accessors:
- (void) setDueDate:(NSDate *)newDate
{
[newDate retain];
[dueDate release];
dueDate = newDate;
}
- (void) setDetails:(NSString *)newDetails
{
newDetails = [newDetails copy];
[details release];
details = newDetails;
}
the init method for the model is (I have removed the dueDate method
calls for simplicity):
- (id) init
{
self = [super init];
if (self) {
[self setValue:@"New Task Item" forKey:@"details"]; }
return self;
}
i have also tried this init:
- (id) init
{
self = [super init];
if (self) {
[self willChangeValueForKey:@"details"];
[self setDetails:@"New ToDoItem"];
[self didChangeValueForKey:@"details"];
}
return self;
}
When I click on the "New Task" button, which is bound to insert, an
instance of the model is created (and values can be put in), but the
default values from the init method never appear. The new row is
completely blank.
I am sure this will be a "Doh!" moment, but does anyone know what I am
doing wrong?
_______________________________________________
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