Re: NSTextField sizeToFit vertically?
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.