• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Generating default values in a bindings controlled Tableview
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Generating default values in a bindings controlled Tableview
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: Different features for different OSs
  • Next by Date: Re: Self terminating popup window - need help
  • Previous by thread: Moderator: EOT Re: awakeFromNib not called
  • Next by thread: Re: Generating default values in a bindings controlled Tableview
  • Index(es):
    • Date
    • Thread