Re: sizeToFit
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>) |