Re: NSBrowser column titles disappear when scrolled [SOLVED]
Re: NSBrowser column titles disappear when scrolled [SOLVED]
- Subject: Re: NSBrowser column titles disappear when scrolled [SOLVED]
- From: Bill Cheeseman <email@hidden>
- Date: Tue, 06 Sep 2011 06:30:33 -0400
On Sep 5, 2011, at 8:39 AM, Bill Cheeseman wrote:
> Long ago, I found that NSBrowser column titles disappear when the user manually scrolls the browser horizontally, or clicks a cell that forces the browser to scroll horizontally to show the children of the new selection in the next column. Manually resizing the window or any column causes them to reappear immediately. (This is with the browser set so that each column takes its title from the previous column's selection, and the user is allowed to resize columns.) This seems like it must be a bug in NSBrowser.
>
> For many years, I cured the problem by implementing the -browserDidScroll: delegate method and calling -setNeedsDisplayInRect: on the title frame of the last column.
>
> That fix no longer works in Lion, and I can't find any other way to fix it.
The solution is very surprising. I had always called -[NSBrowser setTitled:], setting it to YES in my window controller's -awakeFromNib method. This does have the expected effect of showing column titles initially -- but they disappear when the browser is scrolled horizontally, although the rect where they initially appeared is still there above the browser.
The solution is to set the "Titled" checkbox in Interface Builder instead of calling -setTitled: in -awakeFromNib. Surely this is a bug in NSBrowser, and it must have been around since Jaguar or earlier.
I also notice that setting "Titled" in Interface Builder causes "Separators" to be checked when you close the Interface Builder editor and then reopen it. It isn't nice to have Interface Builder automatically changing settings behind my back like this. Also, if I call -setSeparatesColumns: along with -setTitled in -awakeFromNib instead of using Interface Builder, the column titles still don't work right. So this is clearly a case of Interface Builder settings working when the corresponding methods do not work correctly. To add to the mystery, the documentation for -setSeparatesColumns: says its value "is ignored if -isTitled: does not return no." The double negative must have confused the author of that sentence, because the value of YES does seem to be required (at least in Interface Builder) for column titles to work correctly.
--
Bill Cheeseman - email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden