Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The data cell of a column isn't copied. The cell is configured for the proper value for the column in each row and drawn in its proper place. A good place to hook in is at the NSTableColumn method <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTableColumn_Class/Reference/Reference.html#//apple_ref/occ/instm/NSTableColumn/dataCellForRow:" rel="nofollow noreferrer">-dataCellForRow:</a>. In a custom subclass, you could override this method and pass either its -dataCell for normal operation or some alternate cell type.</p> <p>I had an occasion to have a checkbox column representing "include" in an outline view that only appeared for children (non-root items). The root items couldn't be excluded, only their children, so it made sense only to show the checkbox for non-root items.</p> <p>I created a custom NSTableColumn subclass that took a delegate (my data source controller) and checked to see if it responded to the selector -deadCellColumn:shouldShowDeadCellForRow:. If it did, I called that method (which was implemented on my data source controller) to ask it if I should show a "dead cell" (a basic NSCell subclass that draws nothing) and swapped it according to the answer. If the delegate didn't respond to the selector, the table column returns its normal -dataCell.</p> <p>The custom cell (which I called "DeadCell") was needed here because I wanted to ensure nothing got drawn and nothing was editable. I'm not sure it was strictly necessary but I did it anyway. This isn't much use in your case, but I wanted to state it anyway for completeness.</p> <p>Your situation is a bit more complicated, especially because Bindings are involved (and different data cell types can have different bindings for their value -- popups can be especially challenging). In my case, I eschewed bindings for the tried-and-true data source mechanism. It simplified things greatly. :-) For your case, it's easy enough to swap cell types around using data source methods.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload