Re: Outline view and horizontal scrolling
Re: Outline view and horizontal scrolling
- Subject: Re: Outline view and horizontal scrolling
- From: John Stiles <email@hidden>
- Date: Tue, 04 Dec 2007 16:41:13 -0800
OK, so I've been trying to implement the "accepting defeat" solution and
even that is proving to be a challenge.
I can't seem to find a way to properly determine the width of the
"indentation marker" (the disclosure triangle) and there doesn't appear
to be one. The icon itself is 16 pixels across, but there's padding as
well and I don't want to just hard-code a value unless I have to.
Because of this, I come up short by 25 pixels or so when I do this:
NSAttributedString* str = ... my item's title ...;
int level = ... the depth of my item in the tree ...;
float indent = [outlineView indentationPerLevel];
float width = [str size].width + (indent * level);
Is there a better way that I'm missing? I never would have guessed that
this would be difficult.
Leopard added a method "frameOfOutlineCellAtRow:" which would probably
do the right thing, but I'm not ready to require Leopard just for this
(I am using the 10.4 SDK so it was inconvenient to even see if this
generated good results or not).
John Stiles wrote:
I have an outline view which can grow and shrink when the window
resizes. It has one table column; I'm hiding the header since there's
only one column and it doesn't really make sense to show it.
By default I've found that this single column will grow and shrink
itself dynamically as the window resizes to match the outline view's
size. This means that I never get a horizontal scroll bar unless the
outline view gets smaller than the column's minimum width, even when
items in the outline view are actually truncated. The behavior I'd
like to see is a horizontal scroll bar appearing whenever any of the
outline view's items get clipped, but I can't figure out an easy way
to do this.
If I could make the column's minimum width automatically track the
longest /visible/ item inside the outline view, I think it would work
the way I want it to, but that doesn't appear to be an option (short
of recalculating the min-width every time the user opens or closes a
triangle). The best option I've thought of so far would be to find the
widest item in the outline view and set the column minimum width to
that value, but that isn't perfect either—when the widest item is
hidden behind a closed triangle, we'd see a scroll bar for no reason.
Is this solvable or should I just accept defeat and set the column's
minimum width to the width of the widest item in the whole tree? (Or
will Cocoa do some magic behind the scenes so that this will all "just
work?")
_______________________________________________
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
_______________________________________________
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