Re: This winodw has a parent window

Christiaan Hofman <[email protected]> Tue, 21 Dec 2010 21:04:54 +0100
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Dec 21, 2010, at 20:17, aglee wrote:

> On Dec 21, 2010, at 01:54 PM, Christiaan Hofman <[email protected]> wrote:
>> Actually the panel does have an overlay child window. Though I see no reason why this would be a problem, and it also does not seem to be what the log message refers to (it says parent window, not child window).
>  
> I wasn't sure whether the "<NSPanel : 0x9cc300>" refers to "this window" or the parent window.
> 
> In any case, unless you're using some third-party code that prints this message, I'm out of ideas except to echo Eric Gorr's suggestion to try to create a minimal reproducible case.
> 
> Good luck,
> --Andy
> 

Apparently the print panel was a red herring. I also get the same log when I just move the window. Somehow I never got this before, at least this is the first time I notice it. The print sheet just happened to move the window because the print sheet was too big. I can reproduce this in about the simplest case, just add a child window to a window and move the window. Now this log is pretty annoying.

If anyone wants to see it, I just created an app from the standard simple app template, adding the following to the app delegate implementation (and an NSWindow ivar named overlay):

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    NSRect rect = [window contentRectForFrameRect:[window frame]];
    overlay = [[NSWindow alloc] initWithContentRect:rect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
    [overlay setAlphaValue:0.5];
    [overlay setBackgroundColor:[NSColor redColor]];
    [overlay orderFront:nil];
    [window addChildWindow:overlay ordered:NSWindowAbove];
}

Christiaan