1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Source List

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

  1. macrumors 6502

    #1
    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!
     
  2. macrumors regular

    #2
    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.
     
  3. macrumors 6502

    #3
    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