Hi. In my WebKit-based app, there is an occasional popup window, and
I'm trying to make it so that when you move the main window around,
the popup moves as well.


Here is my typical, vanilla WebView delegate method. In it, new
windows are made visible:

- (void)webViewShow:(WebView *)aSender {
    NSDocumentController *theDocumentController =
[NSDocumentController sharedDocumentController];
        MyDocument *theDocument = [theDocumentController
documentForWindow:[aSender window]];
        [theDocument showWindows];
}



I tried adding this just before the [theDocument showWindows] call:

- (void)addChildWindow:(NSWindow *)childWindow
ordered:(NSWindowOrderingMode)orderingMode


like so:

- (void)webViewShow:(WebView *)aSender {
    NSDocumentController *theDocumentController =
[NSDocumentController sharedDocumentController];
        MyDocument *theDocument = [theDocumentController
documentForWindow:[aSender window]];

        [[self window] addChildWindow:[aSender window] ordered:NSWindowAbove];
        
        [theDocument showWindows];
}




but it doesn't work.  I get *** -[MyDocument window]: unrecognized
selector sent to instance 0x1613ab30 in the run log.

aSender is the WebView in the main window.
self is the MyDocument object, and it has a window outlet that I can
see when I right-click the File's Owner in IB.



It seems to me that I want the new window to be made a child of the
current window. I obviously have something wrong, but I can't figure
out what.

I also tried:

        [[[self webView] window] addChildWindow:[aSender window]
ordered:NSWindowAbove];


but that just crashes.




Thanks,
-s
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to