Need to develop Table for settings like Build section in Project settings

Discussion in 'Mac Programming' started by i.yalovecky, Aug 31, 2010.

  1. macrumors member

    Joined:
    Feb 24, 2010
    #1
    From what i need to start? May i do it with TableView or better from scratch? May be somewhere exist something like this?
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    If you want the collapsible style then you'll need an NSOutlineView. It looks like you might be able to use outlineView:dataCellForTableColumn:item: to get the full row appearance that Xcode uses for each setting group (e.g. Architectures, Build Locations, etc.) with a custom NSCell.

    Everything else looks fairly standard though.
     
  3. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #3
    So this is actually really easy to do. I didn't know that the gray group header style is already built-in (new in 10.5). You just need to implement outlineView:isGroupItem:. But in order to get it to look *exactly* like Xcode you need to implement outlineView:dataCellForTableColumn:item: as well and return an NSTextFieldCell. No custom classes required.
     
  4. thread starter macrumors member

    Joined:
    Feb 24, 2010
    #4
    Great thanks, now im trying to do my task with OutlineView, for that purpose i explore DragNDropOutlineView example. And now i confused with one problem. I populate OutlineView through [SRC]
    - (NSArray *)childrenForItem:(id)item {
    if (item == nil) {
    return [rootTreeNode childNodes];
    } else {
    return [item childNodes];
    }
    }

    - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item {
    // 'item' may potentially be nil for the root item.
    NSArray *children = [self childrenForItem:item];
    // This will return an NSTreeNode with our model object as the representedObject
    return [children objectAtIndex:index];
    }
    [/SRC]
    Top level showed pretty well, but with next i have EXC_BAD_ACCESS, and its really bad, its retuen NSTreeNode object with my DSimpleNodeData in representedObject, but no data there((

    But it was inserted, im sure
     
  5. thread starter macrumors member

    Joined:
    Feb 24, 2010
    #5
    Huh, it was problem in my init. Three hours wasted))
     

Share This Page