• 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: Vertically-expanding NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vertically-expanding NSTextField


  • Subject: Re: Vertically-expanding NSTextField
  • From: Andrew Bowman <email@hidden>
  • Date: Thu, 11 May 2006 13:22:29 -0700


On May 11, 2006, at 10:44 AM, Justin R. Miller wrote:

On May 11, 2006, at 12:33 PM, Andrew Bowman wrote:

My deployment target is for 10.4. This app is for my senior project, so I'm not worrying about running this on anything below 10.3. I've tried throwing in a sizeToFit call in my textDidChange method, and it is making my textfield jump to a lower position in the window with very small width. No autosizing of any kind is occurring either.

I've nearly got this working in textDidChange:, comparing the NSTextField's cell width to the NSTextField's width to see if we've wrapped, then creating a new NSRect and using NSWindow's setFrame:display:animate: to do the resize.


I say nearly because I just figured it out this morning and have yet to test and finalize some stuff, but it's mostly there. This is the only way I've been able to figure out if the field has wrapped to a separate line yet.

The end result is the field expands to two lines once the typing does, but backs off to one if enough content is deleted to warrant it going back to one.

I'm a bit confused on how you're doing the resizing, could you provide a bit more detail?


Also, how are you obtaining the NSTextField cell? I can't seem to find the accessor for this.

Lastly, why are you resizing the window rather than the textfield? I can understand doing this if the textfield is the only thing in the window, but it looks like this might be a bit trickier if you have other elements which adjust their positions as the window resizes.

- Andrew Bowman
_______________________________________________
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


References: 
 >Vertically-expanding NSTextField (From: Andrew Bowman <email@hidden>)
 >Re: Vertically-expanding NSTextField (From: Uli Kusterer <email@hidden>)
 >Re: Vertically-expanding NSTextField (From: Andrew Bowman <email@hidden>)
 >Re: Vertically-expanding NSTextField (From: "Justin R. Miller" <email@hidden>)

  • Prev by Date: Re: malloc during selectAll -> crash
  • Next by Date: Re: Vertically-expanding NSTextField
  • Previous by thread: Re: Vertically-expanding NSTextField
  • Next by thread: Re: Vertically-expanding NSTextField
  • Index(es):
    • Date
    • Thread