• 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: Preferred hight of NSTextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preferred hight of NSTextField


  • Subject: Re: Preferred hight of NSTextField
  • From: Greg Herlihy <email@hidden>
  • Date: Thu, 02 Feb 2006 13:09:57 -0800
  • Thread-topic: Preferred hight of NSTextField

Calling [myField sizeToFit] is another way to ensure that the the text field
has adequate height.

Greg


On 2/2/06 10:53 AM, "Kaspar Mösinger" <email@hidden> wrote:

>
> 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


 _______________________________________________
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: 
 >Re: Preferred hight of NSTextField (From: Kaspar Mösinger <email@hidden>)

  • Prev by Date: Re: converting/reading input argument as utf8
  • Next by Date: Re: Binding NSPopupButton to a set of NSObjects
  • Previous by thread: Re: Preferred hight of NSTextField
  • Next by thread: Keyboard navigation for a view
  • Index(es):
    • Date
    • Thread