Re: NSTable Newbie Issues
Re: NSTable Newbie Issues
- Subject: Re: NSTable Newbie Issues
- From: Larry Fransson <email@hidden>
- Date: Tue, 13 Jul 2004 17:31:32 -0700
First question: Does -windowDidLoad actually get called? I can't tell
from your code here what your class inherits from. If it's not a
subclass of NSWindowController, I don't guess it will be called any
time soon. Otherwise, put an NSLog in there to let you know if it does
get called.
I'll also make a suggestion. Don't use your variable names
(personal_Table) as parameter names like you did in the tableview data
source methods. You're letting yourself in for a lot of confusion at
the very least. Use parameter names like "aTableView" instead.
You're not trying to connect this method to any one table. The
parameter is there so that you can use one controller for multiple
tables.
Larry Fransson
Seattle, WA
On Jul 13, 2004, at 14:45, Kodex wrote:
I am trying to get a few tables working on my app. I
have a diffrent controller for each one. And 3 out of
the 4 will have static data. I having been trying to
follow the guides out there and none of them seem to
work. I compile with no errors and console dosnt dump
any errors on me. I was wondering if anyone could spot
the trouble with my code. Thanks
//Header file contents
// IBOutlet NSTableView *personal_Table;
// NSMutableArray *records;
// NSString *name;
#import "personalTable.h"
@implementation personalTable
-(void)windowDidLoad
{
[personal_Table setDataSource: records];
name = @"test";
[records addObject:name];
[personal_Table reloadData];
}
- (id)tableView:(NSTableView *)personal_Table
objectValueForTableColumn:(NSTableColumn
*)aTableColumn
row:(int)rowIndex
{
id theRecord, theValue;
NSParameterAssert(rowIndex >= 0 && rowIndex <
[records count]);
theRecord = [records objectAtIndex:rowIndex];
theValue = [theRecord objectForKey:[aTableColumn
identifier]];
return theValue;
}
- (void)tableView:(NSTableView *)personal_Table
setObjectValue:anObject
forTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
id theRecord;
NSParameterAssert(rowIndex >= 0 && rowIndex <
[records count]);
theRecord = [records objectAtIndex:rowIndex];
[theRecord setObject:anObject forKey:[aTableColumn
identifier]];
return;
}
- (int)numberOfRowsInTableView:(NSTableView
*)personal_Table
{
return [records count];
}
@end
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.