Re: non-live window resizing
Re: non-live window resizing
- Subject: Re: non-live window resizing
- From: John Nairn <email@hidden>
- Date: Wed, 16 Oct 2002 16:46:18 -0600
On Wednesday, October 16, 2002, at 03:02 PM,
email@hidden wrote:
>
--On Tuesday, October 15, 2002 11:10 PM -0400 Cameron Hayne
>
<email@hidden> wrote:
>
>
> On 15/10/02 6:39 pm, "Steve Gehrman" <email@hidden> wrote:
>
>
>
>> Window resizing is still painfully slow. Has anyone implemented a
>
>> hack
>
>> to NSWindow to do non live window resizing(ie. just a rubberband
>
>> rectangle)?
>
>
>
> I assume you are talking about the resizing behaviour of your own
>
> app. You
>
> can gain control of this - see the NSView method inLiveResize, etc.
>
>
It can still be painfully slow, though--even when you optimize drawing
>
and/or remove GUI elements during a live resize. Particularly, a
>
complex
>
window with a lot of embedded views (divided by split views, say) seems
>
simply unable to resize responsively, especially on "slow" hardware
>
(like a
>
dual processor 500MHz G4, or anything not the top of the latest line).
>
Unless perhaps you "disappeared" most of the window's contents, which
>
in
>
most users' opinions looks weirder and more disconcerting than
>
outline-resizing.
>
>
My boss recently told me to figure out a way to implement old-style
>
wireframe resizing in a Cocoa application that exhibits this problem,
>
so
>
I'd be interested to hear any relevant experiences people have had
>
(about
>
optimizing resize and/or implementing outline resize for a Cocoa
>
window)...
>
>
Regards,
>
--
>
Mason Mark
>
Five Speed Software, Inc.
>
I do not have wireframe resizing, but I had a complicated image that
could be slow to draw. I timed the views drawRect method and then
disabled live resizing when the draw time was too slow. When live
resizing is off, my view is cleared to white and then redrawn when
window resizing is done. I assume there are methods your can trap
during the live resizing and draw something faster during the process
(e.g. wire frame or frame showing your interface objects). I did not
bother.
Here is relevant code:
- (void)viewDidEndLiveResize
{
if(drawTime>MAX_DYNAMIC_TIME)
[self setNeedsDisplay:YES];
[super viewDidEndLiveResize];
}
- (void)drawRect:(NSRect)rect
{
NSDate *beginTime=[NSDate date];
// skip in live resizing and too slow
if([self inLiveResize] && drawTime>MAX_DYNAMIC_TIME) return;
// possibly slow drawing code follows
...
drawTime=-[beginTime timeIntervalSinceNow];
}
------------
John Nairn (1-801-581-3413, FAX: 1-801-581-4816)
Web page:
http://www.mse.utah.edu/~nairn
_______________________________________________
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.