Re: Text Layout problems
Re: Text Layout problems
- Subject: Re: Text Layout problems
- From: Ben Lachman <email@hidden>
- Date: Mon, 6 Mar 2006 14:03:25 -0500
On Mar 6, 2006, at 12:51 PM, Douglas Davidson wrote:
On Mar 5, 2006, at 11:37 AM, Ben Lachman wrote:
So I set up the text view to be vertically resized by the layout
manager via setVerticallyResizable:YES and set the text container
to resize horizontally with setWidthTracksTextView:YES per the
documentation. However when I size the window down to where the
text view must resize, the blank space at left at the top of my
text container gets ignored and the text which was drawn 10 units
from the top of the view is mashed up against it.
I think this might be a "feature" of the layout manager since
calling the usedRectForTextContainer: returns a rectangle that
doesn't include the top portion of the text container (I'm not
saying this is necessarily wrong behavior since that portion of
the container is empty, its just not what I want it to do) and the
layout manager is what resizes the text view (according to the
docs). So my basic question is, how do I stop this from
happening? Is there a function in the layout manager that I can
override? In looking through the class docs I can't figure out
what it would be.
Remember that the layout manager always works in container
coordinates, which are offset from the text view's coordinates by
the textContainerOrigin. The text view controls this origin, which
is based on the textContainerInset, but which may be modified, for
example if there is not enough space in the view for both the inset
and the text. This may be what you are seeing; take a look at
these values and find out.
Thanks for the input...
I looked at these values and the containerOrigin.y does indeed change
(to -10 in this case). The inset is 0,0 and never changes. The rect
return by [layoutManager usedRectForTextContainer:textContainer] has
an origin.y of 10. So apparently the layout manager is being smart
and figuring out that it doesn't need that extra space and therefore
resizing the text view accordingly. However, I don't want it to do
this (and I don't particularly think this is very logical behavior)
since I need an inset only at the top (and left side, but that isn't
autoresized) of my text view and not the bottom.
Any suggestions on how to do this?
->Ben
_______________________________________________
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