Programmatically resized NSWindow not being redrawn?
Programmatically resized NSWindow not being redrawn?
- Subject: Programmatically resized NSWindow not being redrawn?
- From: Daniel Vollmer <email@hidden>
- Date: Tue, 31 Jan 2006 09:11:03 +0100
Hi all!
I have an NSDocument-based application, which basically consists of
of a NSCustomView (embedded in an NSScrollView) displaying images.
When an image is set, I adjust the size of the window; but this seems
to not always be redrawn correctly, i.e. about every 3rd or 4th image
opened, the NSWindow is not drawn correctly (only the original size
of the window is visible, the whole window decoration is missing),
see http://www.maven.de/pics/redraw_bug.png. This is "fixed" (i.e.
the window displays the proper in the proper size and with all the
decorations) when I hide (or minimize) and re-show the window.
The following code is responsible for resizing the NSCustomView:
- (void)setImageSize:(NSSize)size
{
if (size.width != imageSize.width || size.height != imageSize.height)
{
NSPoint p;
NSSize winsize;
NSRect screen, window;
imageSize = size;
// set the maximum size for the window
[[self window] setContentMaxSize:size];
// set the actual size of window (adjusted to screenspace)
screen = [[NSScreen mainScreen] visibleFrame];
window = [[self window] frame];
winsize = NSMakeSize(MIN(screen.size.width - window.origin.x,
size.width), screen.size.height);
[self setFrameSize:size];
[[self window] setContentSize:winsize];
[self setNeedsDisplay:YES];
[[self window] display]; // doesn't fix it
// [[self window] displayIfNeeded];
}
}
Could it be the the resizing of the NSWindow is posted to the event
loop, processed later, and then not properly being marked as needing
a redisplay?
Thanks,
Daniel.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden