Re: Outline view and horizontal scrolling
Re: Outline view and horizontal scrolling
- Subject: Re: Outline view and horizontal scrolling
- From: Greg Titus <email@hidden>
- Date: Tue, 4 Dec 2007 17:04:36 -0800
On Dec 4, 2007, at 4:41 PM, John Stiles wrote:
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).
Try -frameOfCellAtColumn:row: (a method from NSTableView). I believe
that should already have the indentation applied to it (so the
origin.x will be where your string starts), so you ought to be able
to just add on the string width to the rect's origin.x.
Hope this helps,
- Greg
_______________________________________________
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