views:

56

answers:

1

I am looking to make a checkbox cell only displays it self on the child's row's inside the outline view, so when you drop down the parent the checkbox will appear for the child entity's rows. What would I need to do this? If this helps here is a Picture of the Entity Diagram: http://snapplr.com/phrn

+1  A: 

Here, the delegate methods are your friend, particularly

- (NSCell *)outlineView:(NSOutlineView *)outlineView dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item

This will get called before each cell is drawn in the outline view. It gives you an opportunity to specify which cell should be used for the given row/column combination. You can return an NSButtonCell configured as a checkbox for the child items, and you can return a blank NSCell.

For every other column, the documentation recommends simply returning [tableColumn dataCellForRow:row].

Alex
Would I need more code that what you have entered, if so what? And where will I put the code, should I put it in the Delegate File?
Joshua
You need to write a delegate method to return the NSCell object you want to display for each cell in the outline view with the method signature I gave above. You put the method in whatever class you've set as the delegate for the outline view.I'm not sure what you mean by "Delegate File". Typically, whatever class you're using as the controller for the view should be its delegate. Depending on your application's architecture, that would most likely be a subclass of NSWindowController or NSViewController.
Alex
So will I need more than one line of code?
Joshua
Of course you will.
Alex