Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ranguvar

macrumors 6502
Original poster
Hey ho,

I'm trying to create source list like those in the Finder and iTunes. I downloaded Apple's SourceView demo-program and other available source code, but all those programs use NSTreeControllers in their xib-files.
I tried to write my source list without such a controller (this seems somewhat too point-and-clickish), and succeded to some extent.
The problem is that now, the label-font of the expandable items (like the "PLACES", "DEVICES" and "SEARCHES" groups in the Finder) is not grey and inset, and the sub-items' label-font is a little larger than in the Finder (e.g. disk names, "Documents"-folder label, etc.).
How can I fix those issues?

ranguvar


P.S.: Sorry if I'm being unclear, please ask if you don't understand something!
 
I assume you're using OS 10.5 or later and using NSTableView's support for source lists

Code:
[tableView setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList]

To get the group appearance, you create a delegate for the table view that impliments:

Code:
- (BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row

And returns YES if the row is a group row.

To get them the right size, you can change the table view's text cell's size to "small" in interface builder.
 
I assume you're using OS 10.5 or later and using NSTableView's support for source lists

Code:
[tableView setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList]

To get the group appearance, you create a delegate for the table view that impliments:

Code:
- (BOOL)tableView:(NSTableView *)tableView isGroupRow:(NSInteger)row

And returns YES if the row is a group row.

To get them the right size, you can change the table view's text cell's size to "small" in interface builder.

Thanks so much! Finally I can create source lists!

P.S.: In fact, I use an NSOutlineView, for which the same methods exist.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.