Re: NSBrowser problems
Re: NSBrowser problems
- Subject: Re: NSBrowser problems
- From: Fritz Anderson <email@hidden>
- Date: Wed, 15 Dec 2004 09:09:46 -0600
The normal way to populate an NSBrowser is to set a delegate object that responds to browser:willDisplayCell:atRow:column: and either browser:numberOfRowsInColumn: or browser:createRowsForColumn:inMatrix:.
What you present seems to be none of these methods. You appear to be bypassing the browser to fill its matrices directly, as though you were "pushing" your data into the browser rather than allowing the browser to "pull" the data through your delegate methods.
<http://developer.apple.com/documentation/Cocoa/Conceptual/Browser/index.html>
-- F
On 15 Dec 2004, at 7:48 AM, Charles Françoise wrote:
I'm using the NSBrowser to display 3 columns of data. It works pretty well, but I think I must be doing something wrong because the design seems just strange. For example, to create the data for column 1 I do :
matrix = [browser matrixInColumn:1];
0;i<[matrix numberOfRows];i++)
[matrix removeRow:i];
while (currentElement = [cardsEnumerator nextObject]) {
exists = NO;
names = [matrix cells];
name = [currentElement... (very long useless line)
i=-1;
while (++i<[names count] && !exists) {
if([name isEqualToString:[[names objectAtIndex:i] stringValue]])
exists = YES;
}
if(!exists) {
[matrix addRow];
[browser selectRow:[matrix numberOfRows]-1 inColumn:1];
[[browser selectedCell] setStringValue:name];
}
}
[browser selectRow:0 inColumn:1];
[browser selectCell:[browser selectedCellInColumn:0]];
Somehow, I'm sure there's a better way to do this.
And another thing is : I have a display problem with my NSBrowser. The scrollbar appears funny in column 0. I put it on my web server at http://chrales.ath.cx/Picture 2.jpg
Has anyone worked with NSBrowser ? And seen these problems ?
Thanks, everyone
charles _______________________________________________
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