• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Dynamic NSTextView resizing while keeping Y position constant?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • [SOLVED] Re: Dynamic NSTextView resizing while keeping Y position constant?
      • From: Nick Zitzmann <email@hidden>
References: 
 >Dynamic NSTextView resizing while keeping Y position constant? (From: Nick Zitzmann <email@hidden>)
 >Re: Dynamic NSTextView resizing while keeping Y position constant? (From: Izidor Jerebic <email@hidden>)

  • Prev by Date: Re: iChat plug-ins?
  • Next by Date: Re: Where's the NSWindowController in a default document-based app
  • Previous by thread: Re: Dynamic NSTextView resizing while keeping Y position constant?
  • Next by thread: [SOLVED] Re: Dynamic NSTextView resizing while keeping Y position constant?
  • Index(es):
    • Date
    • Thread