Re: Preferred hight of NSTextField
Re: Preferred hight of NSTextField
- Subject: Re: Preferred hight of NSTextField
- From: Kaspar Mösinger <email@hidden>
- Date: Thu, 2 Feb 2006 19:53:15 +0100
On 02.02.2006, at 18:55, Joshua Scott Emmons wrote:
Is there a way to get the preferred hight of a NSTextField? I want
to resize a window, so that the non-editable textfield has enough
space to display all its lines.
To make sure my text field is tall enough to contain all its text
when I draw it, I use the following:
NSRect frame = [myField frame];
frame.size.height = FLT_MAX;
frame.size.height = [[myField cell] cellSizeForBounds:frame].height;
[myField setFrame:frame];
This also has the quirk of never setting a height less than that
needed to display a single line of text. That may be what you want,
or it may not.
Cheers,
-Joshua Emmons
This is exactly, what I've been searching for!
Thank you!
Kaspar
_______________________________________________
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