Re: String not showing up in Table
Re: String not showing up in Table
- Subject: Re: String not showing up in Table
- From: Philipp Ringli <email@hidden>
- Date: Thu, 3 Feb 2005 16:27:03 +0100
Uhh... I found an answer to one of my questions:
The Problem with the string not showing in the table textfield.
I had:
-(id)classPathTable:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex { ...
But it should've been:
-(id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex { ...
Since the Author of this tutorial...
http://www.macdevcenter.com/pub/a/mac/2001/08/10/cocoa.html?page=1
... was using tableView for the outlet name of the NSTableView, I got
confused. I think that wasn't a lucky name pick by the author!
Maybe someone can enlighten me on my other questions...
Phil
... forgot to add the lower two methods to my last email.
Here's the code again:
Controller.m:
----------------------------------------------------------------
-(NSDictionary *)createRecord
{
NSMutableDictionary *record = [NSMutableDictionary dictionary];
[record setObject:@"Please enter Classpath..." forKey:@"classpath"];
return record;
}
- (IBAction) addRecord:(id) sender
{
[classPathRecords addObject:[self createRecord]];
[classPathTable reloadData];
//NSLog (@"\nclassPathRecords:%@", classPathRecords);
}
-(void)awakeFromNib
{
classPathRecords = [[NSMutableArray alloc] init];
}
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
//NSLog (@"\naTableView:%@\ncount:%@", aTableView, [classPathRecords
count]);
return [classPathRecords count];
}
-(id)classPathTable:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
id theRecord, theValue;
NSLog (@"\naTableColumn identifier:%@", [aTableColumn identifier]);
theRecord = [classPathRecords objectAtIndex:rowIndex];
theValue = [theRecord objectForKey:[aTableColumn identifier]];
return theValue;
}
On 03.02.2005, at 10:52, Philipp Ringli wrote:
I am trying hard to get my table to work. ;-)
The table has two colums, one with a textfield, and one with a check
box.
Is this the right way to set the textfield in the table to "Please
enter Classpath..."?
(The user clicks the Add button and a new row is inserted, that he
then should edit.)
How do I go about adding the value for the check box column to the
dictionary (record)?
Right now, when I add a row using the Add button, a row is added, but
there's no "Please enter Classpath..." in the textfield.
And I can't check the check boxes.
Thanks,
Phil
_______________________________________________
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
_______________________________________________
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