Ask a Question related to Mac Programming, Design and Development.
-
Willian Irving Zumwalt #1
help w/ multiple columns in NSTableView
Hey All,
I'm trying to load a file with columns of data separated by white
space and display it in an NSTableView. The file loads fine, but each
line of data is being shown in each and every column for that row.
Here's an example of four rows of data from the file.
0 -0.749318 0.0892089 -1
1 -0.171308 0.167947 1
2 -0.651408 0.923422 -1
3 0.380259 -0.414841 1
My problem is that the first row of data is put in every column on the
first row, the second row in every column of the second row, and so
on. I'm not sure how to split the data up and place each item in a
column.
Below is my code.
Any help much appreciated.
--- mycontroller.mm ---
- (void)filePanelDidEnd:(NSWindow*)sheet returnCode:(int)returnCode
context:(void*)contextInfo
{
...
while ([scanner scanUpToString:@"\n" intoString:¤tLine])
{
...
listItems = [currentLine componentsSeparatedByString:@" "];
}
[lines addObject:listItems];
}
- (id)tableView:(NSTableView *)tableView
objectValueForTableColumn:(NSTableColumn *) tableColumn row:(int)row
{
return [lines objectAtIndex:row];
}
Willian Irving Zumwalt Guest
-
displaying multiple columns in <cfselect>
ok, I have a database that house a table called model. The model contains a manufacturer foreign key and 3 other fileds for that table. I want... -
STD of multiple columns
Dear Mysql-ians, I want to calculate the standard deviation of data that are in multiple columns. I know how to calculate the STD of 1 column... -
Datagrid in multiple columns
It is possible to arrange the datagrid it self into multiple columns? For example I have a grid with two items - id and name. I have over 600... -
Total of multiple columns in datagrid
I am using VB 6 and have a bound datagrid pulling data from a Pervasive Database by ODBC connection. Column 3 shows opening balance and columns 4-15... -
[Cocoa] Bug with NSTableView?
> I'll check these accessor methods, as this may be the problem. It was the setCol* methods that were causing the problem. I stupidly put:... -
matt neuburg #2
Re: help w/ multiple columns in NSTableView
Willian Irving Zumwalt <wizumwalt@yahoo.com> wrote:
You've no cause for complaint; Cocoa is doing exactly what your code is> I'm trying to load a file with columns of data separated by white
> space and display it in an NSTableView. The file loads fine, but each
> line of data is being shown in each and every column for that row.
>
> - (id)tableView:(NSTableView *)tableView
> objectValueForTableColumn:(NSTableColumn *) tableColumn row:(int)row
> {
> return [lines objectAtIndex:row];
> }
telling it to do. If you want Cocoa to do something else, you will have
to write different code.
For example, if you want various things to appear in various columns,
you will need to use the tableColumn parameter you're being handed. The
value you return will depend upon this, as well as upon the row
parameter. Eh? m.
--
matt neuburg, phd = [email]matt@tidbits.com[/email], [url]http://www.tidbits.com/matt/[/url]
Read TidBITS! It's free and smart. [url]http://www.tidbits.com[/url]
matt neuburg Guest
-
Eric Pepke #3
Re: help w/ multiple columns in NSTableView
[email]wizumwalt@yahoo.com[/email] (Willian Irving Zumwalt) wrote in message news:<dd8fee65.0309201458.68d040e4@posting.google. com>...
objectValueForTableColumn is supposed to return different,> - (id)tableView:(NSTableView *)tableView
> objectValueForTableColumn:(NSTableColumn *) tableColumn row:(int)row
> {
> return [lines objectAtIndex:row];
> }
column-specific information based on which column it is.
So, you have to look at tableColumn, figure out which one
it is, and then break up your line and return the correct
chunk accordingly.
Eric Pepke Guest



Reply With Quote

