Hello,
I am currently trying to make some alterations to a subclass of NSTableView that provides the ability for rows to resize to show wrapped text. Almost everything is working fine, but there is one minor ugliness I would like to correct, but cannot find any way of doing it. At the moment, if you resize a column, the row will not resize itself until after you have stopped resizing the column. This doesn't look brilliant. However, if you resize the whole window, the rows resize themselves accordingly.
After experimenting, I found that this is because during a live resize of a window, NSTableViewColumnDidResizeNotification is sent constantly. I have columnDidResize: set up to recalculate the heights of the rows, so this all works fine during window resizing. However, if you resize a column directly by dragging its edge, NSTableViewColumnDidResizeNotification is only sent after the operation has finished.
I was hoping that there would be something equivalent for "column is resizing", but there doesn't seem to be anything. I tried checking if a column was resizing from the overridden tile method by using the resizedColumn method from NSTableHeaderView, which returns the index of a column if one is being resized or -1 otherwise, like this:
if ([[self headerView] resizedColumn] != -1)
// recalculate grid and heights etc
However, this causes all sorts of drawing problems, presumably because it is being called to often.
Does anybody have any suggestions of how I can work around this? Basically I just need to be told when a column is resizing, and recalculate the heights and grid accordingly, but it has to be efficient to avoid drawing problems.
Many thanks for any suggestions, apologies if I've missed something obvious,
KB