Re: Bound NSBrowser always shows horizontal scrollbar
Re: Bound NSBrowser always shows horizontal scrollbar
- Subject: Re: Bound NSBrowser always shows horizontal scrollbar
- From: Jeremy Dronfield <email@hidden>
- Date: Sun, 25 Jun 2006 10:04:43 +0100
On 24 Jun 2006, at 4:42 pm, Glen Low wrote:
I have bound the content, contentValues and selectionIndexPaths of
a NSBrowser to a suitable NSTreeController. Everything works
swimmingly, except that although I set it to hide horizontal
scrollers, they keep on coming back when I click on various browser
items, even when the depth is less than the visible depth of the
browser. Any way of permanently inhibiting the horizontal scroller
display behavior?
I'm not sure if this answer meets your case, since it's not clear
whether you want to suppress the horizontal scrollbar completely or
just rectify its autohide behaviour. Assuming the latter, I found the
same problem and ended up using the following kludge. (In my case I
put this code in -browserColumnConfigurationDidChange:. Alternatively
it could be called when the browser selection changes.)
float totalWidth = 0;
int index, lastIndex = [browser lastColumn];
for (index = 0; index <= lastIndex; index++)
totalWidth += [browser frameOfColumn:index].size.width;
/* First check if total column widths are greater than the visible
width of the browser */
BOOL showScroller = totalWidth > [browser visibleRect].size.width ?
YES : NO;
/* In some cases, the column widths may be less than the visible
width but the leftmost column
is still outside the view, therefore still requiring a scrollbar. */
if (!showScroller)
showScroller = [browser frameOfColumn:0].origin.x < 0 ? YES : NO;
[browser setHasHorizontalScroller:showScroller];
It's a bit ugly but it works for me.
Regards,
Jeremy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden