Re: How to make NSWindow redraw vacated rects "ifNeeded"?
Re: How to make NSWindow redraw vacated rects "ifNeeded"?
- Subject: Re: How to make NSWindow redraw vacated rects "ifNeeded"?
- From: Andrew Farmer <email@hidden>
- Date: Sun, 8 Apr 2007 13:23:05 -0700
On 08 Apr 07, at 08:36, Jerry Krinock wrote:
I often find myself needing to sprinkle in what I feel are extra -
display messages to NSWindows to when I want them to update.
Yesterday I isolated a demo which gets me closer to understanding
this.
<...>
// Update the window
[window displayIfNeeded] ; // Not good enough!!
// Uncomment the next line and it works as desired
// [window display] ;
// Show for 3 seconds
[NSThread sleepUntilDate:
[NSDate dateWithTimeIntervalSinceNow:3.0]];
AppKit depends on the presence of an event loop for a lot of things,
including redrawing views. I'm not exactly sure what you're trying to
accomplish here, but it'll probably work better if you avoid sleeping
outside the event loop. Use NSTimer and -[NSObject
performSelector:withObject:afterDelay:] to implement delayed events.
As a general point, BTW, you should never need to call
setNeedsDisplay, display, or displayIfNeeded on view objects. (Only
exception is a view calling setNeedsDisplay on itself.) The view
should otherwise be able to do redraw management for itself.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden