Re: Question regarding NSTableView
Re: Question regarding NSTableView
- Subject: Re: Question regarding NSTableView
- From: Robert Cerny <email@hidden>
- Date: Wed, 2 Feb 2005 23:03:19 +0100
hi Philipp,
when you make an object a datasource of tableview, you MUST implement
numberOfRowsInTableView and objectValueForTableColumn methods exactly
as the exception says.
Check http://www.cocoadev.com/index.pl?search=NSTAbleView
HTH
Robert
On 2.2.2005, at 22:44, Philipp Ringli wrote:
I getting this error message:
[Session started at 2005-02-02 22:26:06 +0100.]
2005-02-02 22:26:08.472 MTASC-X[1650] *** Illegal NSTableView data
source (<Controller: 0x353110>). Must implement
numberOfRowsInTableView: and tableView:objectValueForTableColumn:row:
I have connected the NSViewTable in IB.
Class Controller has these Attributes:
Outlets:
Outletname: classPathTable Type: id (couldn't this be NSTableView?)
Actions:
addRecord:
saveRecords:
deleteRecords:
In NSTableView Info Panel I have an outlet DataSource -> Controller
In Controller (Custom) Info Panel I have an outlet classPathTable ->
NSTableView(Classpath, Active)
These are excerpts of code from the respective files:
in my Controller.h:
------------------------------------------------
NSMutableArray *classPathRecords; // an array holding dictionary
Objects
IBOutlet id classPathTable; // Ref to View: NSTableView (NIB)
- (IBAction)addRecord:(id)sender;
- (IBAction)saveRecords:(id)sender;
- (IBAction)deleteRecords:(id)sender;
in my Controller.m:
------------------------------------------------
// Handling Classpath Table
-(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 (@"\nclassPathTable:%@", classPathTable);
}
- (IBAction) deleteRecords:(id) sender
{
}
- (IBAction) saveRecords:(id) sender
{
}
-(void)awakeFromNib
{
classPathRecords = [[NSMutableArray alloc] init];
}
-------------------------------------------------
I am *very* new to cocoa, and objective-c. (...you might have already
noticed. ;-) )
Any tip is welcome.
Thanks for reading,
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