NSBrowser Prevent Empty Selection in Column that is > 0

So there's the allowsEmptySelection property, which I have set to NO.


This prevents empty selection in column 0 it seems. Now let's say I have a fairly simple model and my browser only has 2 columns, and there must be a selection in both columns at all times. When changing the selection in column 0, column 1 pops out with no selection. I'm not sure if there's a better way to do this, but I autoselect row 0 in column 1 within:


-(void)browser:(NSBrowser*)browser
didChangeLastColumn:(NSInteger)oldLastColumn
      toColumn:(NSInteger)column

//check if column is column 1...if it is, ensure atleast 1 value is select. Every entry in column 0 has at least 1 child.


The code is a little ugly but I can tolerate it. Now another thing I have to do is track the current selection in column 1, and if the user clicks the background in column 1 (which will empty the selection in column 1) I have to deny it within:


-(NSIndexSet*)browser:(NSBrowser*)browser
selectionIndexesForProposedSelection:(NSIndexSet*)proposedSelectionIndexes
             inColumn:(NSInteger)column
//if column is 1...make sure proposedSelectionIndexes is not empty before returning it.


So now the code is getting even uglier, but I can still tolerate it.


But....if if I double click the current selection in column 0, it empties the selection in column 1 and the browser *does not* consult the delegate by sending another browser:selectionIndexesForProposedSelection:inColumn: message. So now my browser (from the perspective of the data the UI is displaying) is in an invalid state.


I tried setting ignoresMultiClick to NO, but that makes no difference. Any ideas how I can workaround this?


Thanks

NSBrowser Prevent Empty Selection in Column that is > 0
 
 
Q