drawRect without flashing
drawRect without flashing
- Subject: drawRect without flashing
- From: Joshua S Emmons <email@hidden>
- Date: Tue, 11 Mar 2003 12:56:04 -0500
I remember this coming up on the list before, but I couldn't find the
right conglomeration of search terms to grab it from the archives.
Maybe someone with a better memory can point me in the correct direction?
I have a view in a window. The view has several button controls within
it. I want the view to be grey (let's say) and the controls on it to be
visible.
so I subclass NSView and override -drawRect:(NSRect) as follows:
- (void)drawRect:(NSRect)rect {
[[NSColor grayColor] set];
NSRectFill(rect);
}
This works great. There's a grey background with my buttons on top of
it. But then I have a sheet come out that partially obscures the view.
When this happens ALL the controls disappear from the view.
Naturally, I assume that, for some reason, my View's -drawRect is being
called and the controls' are not. So I add some code at the bottom of
the -drawRect listed above that gets an array of all the subviews and
calls -setNeedsDisplay:YES on each.
This works ok, except that my buttons noticably flash now whenever a
sheet comes down. the NSRectFill seems to get called first, and THEN
the buttons all redraw themselves. Is there a way to get it all to
happen at the same time so that my interface doesn't flash every time it
needs to redraw? Is drawRect not where I want to be doing this? Is
there a more direct way to tell the buttons they need to redraw other
than calling their -setNeedsDisplay methods?
With much thanks,
-Josh Emmons
_______________________________________________
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.