Question

I'm programatically resizing my NSWindow containing an NSOpenGLView. The window resizes, the NSOpenGLView is handling the resizing fine, but the titlebar of the NSWindow turns completely white. However the buttons (minimize,...) can be clicked, also you can not see them.

Resizing occurs using the following code in the windows controller. The method is called on the main thread.

-(void)setHeightAndWithToWindow:(NSArray*)heightWidth{
    int width = [(NSNumber*)[heightWidth objectAtIndex:0] intValue];
    int height = [(NSNumber*)[heightWidth objectAtIndex:1] intValue];
    NSRect rect = NSMakeRect(0, 0, width ,height);
    if([window frame].size.height != (rect.size.height - [self titleBarHeight]) ||
        [window frame].size.width != rect.size.width){ 
        [window setFrame:rect display:false animate:true];
    }
}

What could be the reason, that the title bar turns white and does not draw itself again? Can you tell the title bar to draw itself as a workaround?

Thank you

Was it helpful?

Solution

Sounds like you made your OpenGLView too big. When you send [self titleBarHeight], what is self? Is this code in a window subclass or something else?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top