Re: Dynamic NSTextView resizing while keeping Y position constant?
Re: Dynamic NSTextView resizing while keeping Y position constant?
- Subject: Re: Dynamic NSTextView resizing while keeping Y position constant?
- From: Mike Ferris <email@hidden>
- Date: Sun, 20 Jun 2004 11:49:27 -0700
If the text view is set to auto-resize itself vertically, then it may
be that all you really need to do is make sure that its superview is
flipped... If the superview is flipped then the frame origin will be
at the top-left corner of the text view and when the text view resizes
itself to fit the text, it will naturally grow from the bottom.
For more sophisticated resizing, you'll need to watch things... Take a
look at how TextArea.m in the Sketch example handles this... It
watches for textDidChange: notifications as well as using the text
view's built in horizontally/vertically resizable settings.
Mike
Begin forwarded message:
>
From: Izidor Jerebic <email@hidden>
>
Date: June 19, 2004 9:48:24 AM PDT
>
To: Nick Zitzmann <email@hidden>
>
Cc: email@hidden
>
Subject: Re: Dynamic NSTextView resizing while keeping Y position
>
constant?
>
>
On 18 Jun 2004, at 20:13, Nick Zitzmann wrote:
>
>
>
> I'm trying to make an NSTextView that automatically resizes itself
>
> vertically when the user fills it with text to display. But I want it
>
> to grow in height and not change its Y position. The text view is not
>
> inside a scroll view.
>
>
>
>
>
Well, I did it with frame change notifications:
>
1. Enable frame change notifications for NSTextView object
>
2. Subclass NSTextView to keep old frame (or keep old frame somewhere
>
else)
>
3. When frame change notification arrives, set the frame origin of
>
NSTextView to old origin (set the flag to prevent infinite loop with
>
this, because setting the origin will also fire frame change
>
notification)
>
>
If somebody has come up with simpler approach, I too would like to
>
know...
>
>
Regards,
>
izidor
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.