Learning question about NSTableView and NSStrings
Learning question about NSTableView and NSStrings
- Subject: Learning question about NSTableView and NSStrings
- From: "John Tsombakos" <email@hidden>
- Date: Tue, 31 Jul 2001 10:02:12 -0400
Hi,
I'm in the process of getting my head around Cocoa. My
latest test is playing around with the NSTableView. I have a
sample app that has a table view in a window and I have a
data source object created (don't ask my how I figured how
to set that up and wire it up!). I have an outlet in my data
source for the tableview (myTable).
In the interface for my data source, I define an array to
hold the data for the table (a one column table)
(NSMutableArray *myArray)
In the data source's awakeFromNib routine, I create the
array and stick some data into it: (first question-is this
the right place to do this?)
[[myArray alloc] init];
for (i=0; i<=10; i++)
{
[myArray addObject:@"Hello"]
}
(I would like each item to by "Line n" with n being the line
number, but I'm not sure how to set that)
I'm not even sure if that's the right way to set it. I know
it's a simple sample, but I want to start somewhere.
Now, in the tableView:setObjectValue:forTableColumn:row:
routine I do:
return [myTable objectAtIndex:row];
And in the numberOfRowsInTableView: routine I do:
return [myTable count];
It sort of works, except only 7 items show up in the table
view!
Anyone have any suggestions? One thing I'm working towards
is being able to click on one of the rows to "select" the
table, the be able to hit a key to go to the line that
starts with that letter. (Suggestions?)
Thanks,
John T.