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

Re: sizeToFit


  • Subject: Re: sizeToFit
  • From: Sherm Pendley <email@hidden>
  • Date: Thu, 21 Mar 2002 18:50:45 -0500

On Thursday, March 21, 2002, at 06:10 PM, Charles Srstka wrote:

Is there any way to get the size that -[NSControl sizeToFit] would resize a control to without actually resizing the control?

The description of sizeToFit: indicates that it neither redisplays the control nor flags it as needing redisplay. Neither does -[NSView setFrameSize:]. So, you could store the current size of the control, call sizeToFit:, check the new size, and then restore the old size. Since neither sizeToFit: nor setFrameSize: automagically redisplay, there shouldn't be any visible effects from all that.

I can't say how efficient it would be, though. It depends on how "heavy" sizeToFit: and setFrameSize: are - if all they do is recalculate the relevant attributes in preparation for drawing, and leave any heavy lifting to drawRect:, then it should be fine.

sherm--
_______________________________________________
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: 
 >sizeToFit (From: Charles Srstka <email@hidden>)

  • Prev by Date: Re: NSTextView and setString
  • Next by Date: Re: Cocoa's Popularity
  • Previous by thread: sizeToFit
  • Next by thread: Problem with unicode keyEquivalents in MenuItems?
  • Index(es):
    • Date
    • Thread