Question

I'd like to have the same behaviour that Console.app in 10.7.

  • Lines that are truncated come with a disclosure triangle
  • A click on the triangle / a double click on the line / press on "Right Array" expand the NSCell and show the whole text

I was on the NSOutlineView way, but "Accessibility Inspector" reveals that it's not an outline view, but an NSCell.

An idea could be to catch the number of lines, and on specific events (click/double click/left array), modify the height of the current NSCell.

How can I add such a disclosure triangle in my cell ? How can I catch such events ?

Was it helpful?

Solution

Console uses a view-based NSTableView. Each of the cells is a custom subclass of NSTableCellView, which enables it to include the disclosure button.

The disclosure button is probably just calling noteHeightOfRowsWithIndexesChanged: on the table view, which in turn is calling tableView:heightOfRow: on the table view's delegate.

The implementation of the tableView:heightOfRow: delegate method would then be returning the larger height for the expanded rows.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top