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 20:23:53 -0700
On 08 Apr 07, at 19:43, Jerry Krinock wrote:
On 2007 Apr, 08, at 15:46, Adam R. Maxwell wrote:
Did you try [[window contentView] setNeedsDisplay:YES]? You need
to tell the box's superview to redisplay, or else the
displayIfNeeded won't have any dirty rects to redraw (as far as I
understand).
I just tried that now and indeed, it works. Furthermore, as Andrew
suggested, the -setNeedsDisplay messages are unnecessary when your
suggestion is used.
Hang on a second. I just tried to replicate your problem and had no
issues whatsoever with the much simpler
- (void)applicationDidFinishLaunching:(NSNotification *)noti {
// Create window
NSWindow* window = [[NSWindow alloc]
initWithContentRect:NSMakeRect(0,0,300,100)
styleMask:NSTitledWindowMask
backing:NSBackingStoreBuffered
defer:NO] ;
[window center];
NSBox *box = [[[NSBox alloc] initWithFrame:NSMakeRect(20, 10,
260, 40)] autorelease];
[[window contentView] addSubview:box];
[box setFrame:NSMakeRect(20, 50, 260, 40)];
[window orderFront:self];
}
Unless you're writing an NSView subclass, you should never have to
issue redraws yourself. In fact, I'm pretty sure that display,
displayIfNeeded, and displayInRect should only get called from within
AppKit, and setNeedsRedisplay and setNeedsDisplayInRect should only
get called by views on themselves.
_______________________________________________
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