tags:

views:

67

answers:

1

I have a custom NSActionCell used to render some parts of some of the rows in my NSOutlineView. I can receive and respond to clicks on the NSActionCell, but the selection also changes when that cell is clicked. I'd like to prevent the selection from changing if one of my custom NSActionCells are clicked.

Is there an easy way to do this?

A: 

To answer my own question:

If the cell you want to be able to click (and subsequently not select a row) is in it's own column, then the following Apple example is very useful:

DragNDropOutlineView

That example relies on implementing the following NSOutlineViewDelegate method (implemented in AppController.m at line 304):

- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item

If you have a cell within another cell, you can still use that approach, but you'll need to do a bit more work to determine whether the mouse was clicked within your sub-cell. A good example demonstrating that logic is the following Apple example:

PhotoSearch

Ken
An NSCell is always in a single NSTableColumn, since the cell is a property of the column. The only way to have a cell that appears to straddle multiple columns is to fake it.
Peter Hosey