Source List

Discussion in 'Mac Programming' started by ranguvar, Oct 19, 2009.

  1. ranguvar macrumors 6502

    Sep 18, 2009
    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?


    P.S.: Sorry if I'm being unclear, please ask if you don't understand something!
  2. JoshDC macrumors regular

    Apr 8, 2009
    I assume you're using OS 10.5 or later and using NSTableView's support for source lists

    [tableView setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList]
    To get the group appearance, you create a delegate for the table view that impliments:

    - (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.
  3. ranguvar thread starter macrumors 6502

    Sep 18, 2009
    Thanks so much! Finally I can create source lists!

    P.S.: In fact, I use an NSOutlineView, for which the same methods exist.

Share This Page