views:

295

answers:

1

I'm new to Cocoa development - I want to display an aribitrary number of directory paths in a control/view. What's the best type of built-in control/view for this?

Requirements:

  • This should be a flat list only and not a full File System browser.
  • Users should be able to select one (or more) items and remove them (i'll provide a remove button)
  • Users should be able to add items to this list (i'll provide a button that launches a OpenPanel which allows them to select a path)
  • Any suggestions?

    Also, where can I find one of those "|+|-|" type button controls to add/remove items which are common in a lot of the Mac UI?

    Thanks!

    +1  A: 

    Perhaps you're looking for the NSTableView class if you simply want to display the directory paths as a list. The NSOutlineView class is a subclass of NSTableView which allows you to group items in a hierarchical list. Multiple rows can be selected with both classes so multiple items can be removed.

    In answer to your second question, the common +/- square controls are implemented in Interface Builder with square (equal width and height set) NSButtons with the Gradient style. The + and - icons are simply images set with the Image attribute in the inspector - either NSAddTemplate for the + button, and NSRemoveTemplate for the - button.

    Perspx
    I'll try that - thanks!