PDA

View Full Version : NSOutlineView problem with Lion




SpartanTom
May 16, 2012, 10:20 AM
Hi folks,

I'm an experienced developer (on other platforms) who's just starting to take over some Mac development duties at my small company.

I've inheirited an enormous (and unfortunately bug-ridden) code base for our company's in-house relational database frontend. Unfortunately, right when I took over the project, we started a Lion rollout, and I've discovered a vexing issue that only shows up on Lion systems.

I have attached four screenshots, before and afters of opening and closing up parent items (hope I have my terminology right) in an NSOutlineView. This is the same application, running on my Snow Leopard machine and our head of purchasing's brand new Lion system.

As you can see, on the Lion system, something goes wrong when the parent items are opened and the child line is not correctly displayed. Oddly, our application is full of OutlineViews, and this is the only one exhibiting this behavior, and only on Lion systems. The only difference I could find is that when I check out those OutlineViews in InterfaceBuilder, the problem one is a "Row Resizable Outline View." Is that a standard UI component, or did one of our previous in-house devs create that?

I appreciate your time and attention to this message -- I know I probably haven't given enough information for anyone to figure out what's going on, but pointers in the right direction or requests for additional information would be most welcome.

Thanks very much in advance!
Tom

PS - It would appear my attachments disappeared after posting. Hopefully these links will be allowed through:

http://www.divcon.net/images/uiprob/Snow-Leopard-Before-Right.png
http://www.divcon.net/images/uiprob/Snow-Leopard-After-Right.png
http://www.divcon.net/images/uiprob/Lion-Before-Right.png
http://www.divcon.net/images/uiprob/Lion-After-Wrong.png



SpartanTom
May 16, 2012, 04:11 PM
Just of the sake of google and archive searched, just wanted to note that the RowResizableOutlineView is not a standard Apple UI component -- see http://www.evanjones.ca/software/osx-tableview.html. I have switched back to the standard NSOutlineView for that area of our Database in the short term. It's a very low priority on my list of bugfixes, but if I ever get the RowResizables working on Lion again, I'll follow up here.

Thanks,
Tom

Sydde
May 17, 2012, 11:31 PM
It actually is a standard feature of NSTableView (of which NSOutlineView is a subclass) since about 10.5. To do it yourself, you have to have a NSTableView delegate for the outline view, in which you implement -tableView:heightOfRow:. How Evan Jones shoehorned it into the datasource I have not investigated, but that could be the reason for the Lion bug.

Remember that this method will get called frequently, so it should have a very quick way to determine how tall to make the row, perhaps a value cached in the datasource array, to which it should have direct access (datasource and delegate are often the same object).

On a side note, it is unfortunate the Evan Jones used the word "resizable" in his object, because that leads to confusion: "resizable" usually implies the the user has some control over sizing, the more appropriate term would have been "variable height" or something like that.