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
views:
56answers:
1
+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
2009-05-28 19:29:08
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
2009-05-28 20:28:59
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
2009-05-29 14:26:14
So will I need more than one line of code?
Joshua
2009-05-29 18:26:19
Of course you will.
Alex
2009-05-29 20:44:51