• 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: NSTextField sizeToFit vertically?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField sizeToFit vertically?


  • Subject: Re: NSTextField sizeToFit vertically?
  • From: Charles Srstka <email@hidden>
  • Date: Tue, 18 Jun 2002 16:27:17 -0500

Probably not the most elegant, but here's what I'm doing currently:

NSRect oldFrame = [textField frame], newFrame = oldFrame, windowFrame = [window frame];

newFrame.size.height = 10000.0; // an arbitrary large number
newFrame.size = [[textField cell] cellSizeForBounds:newFrame];

if(NSHeight(newFrame) > NSHeight(oldFrame))
windowFrame.size.height += (NSHeight(newFrame) - NSHeight(oldFrame));

[window setFrame:windowFrame display:NO];

If anyone knows of a better way to do this, then I'd like to know it as well. :-)

On Tuesday, June 18, 2002, at 02:41 PM, Steven Frank wrote:

The content. In other words, I want the NSTextField to grow only along its vertical axis until all of the text is visible. -sizeToFit does this, but horizontally.

Steven

On Tuesday, June 18, 2002, at 12:33 PM, alex wrote:

Resize to fit what? Its content or the "surroundings"?

Is there an equivalent to [someNSTextField sizeToFit] that will resize the text field vertically instead of horizontally?
_______________________________________________
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.

References: 
 >Re: NSTextField sizeToFit vertically? (From: Steven Frank <email@hidden>)

  • Prev by Date: Re: Drag 'n Drop 'n Delegation Dilemma
  • Next by Date: Re: Distant DO
  • Previous by thread: Re: NSTextField sizeToFit vertically?
  • Next by thread: Distant DO
  • Index(es):
    • Date
    • Thread