Sample Outline View Table


somebody can post an example of ASOC using a Outline View Table?
Seems to be more complicated that normal table.


I would also love to see a basic ASOC outline view tutorial/project. I’ve had a look at a few different cocoa examples but am struggling to implement this with ASOC.

The cocoa examples are not so hard but the code is almost written twice. It’s written for cocoa bindings and written with a datasource. For someone with a little knowledge of Objective-C these example codes can be confusing. So my question is what example do you want? Data source or with bindings? I think you should use bindings in ApplescriptObjC and for Objective-C it doesn’t matter. The binding is a predefined and limited data source and in applescriptObjC you let cocoa handle the data representation.

you only need 4 handler in a data source
-(BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
This function needs to return if an iitem[/i] has children or not. In other words is this item collapsable? Return a boolean

-(NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
Is comparable number of rows in NSTableView. Only difference is that outline views have hierarchical structures so an item with children contains rows (for opening an item). So return the number of items the iitem[/i] contains

-(id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
create or return the object that is assosiated with this cell in the outlineview. index is the row number in the parent item. The object you return here will be used in the other three delegates as an argument iitem[/i]. This is importand to know

-(id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
return or create the object for the data cell. When the cell is a NSTextFieldCell you should return a NSString object or when the cell is defined as an NSImageCell then you should return a NSImage.

Thanks DJ Bazzie Wazzie. I have seen those handlers, and will take a closer look at your descriptions. Ideally I was looking for an example using an array controller, as I’ve found it much easier to work with these in my nstableview project.