I've solved it, finally. My mistake was not realizing that the (WebView *)sender being passsed into webViewShow: is the CHILD webView. I needed to act on the parent webView before things got that far.
I added the call to addChildWindow:ordered: and things work perfectly. Move the main window, and the popup moves right with it. - (WebView *)webView:(WebView *)aSender createWebViewWithRequest:(NSURLRequest *)aRequest { MyDocument *theDocument = [[NSDocumentController sharedDocumentController] openUntitledDocumentOfType:@"MyDocumentType" display:YES]; [[[theDocument webView] mainFrame] loadRequest:aRequest]; //put the parent child stuff here [[aSender window] addChildWindow:[[theDocument webView] window] ordered:NSWindowAbove]; return [theDocument webView]; } aSender is the parent webView that is passed into the method [aSender window] is the parent webView's window theDocument is the child document object [[theDocument webView] window] is the child document's webView's window On Thu, Jul 31, 2008 at 1:43 PM, Sumner Trammell <[EMAIL PROTECTED]> wrote: > Nope. This version crashes as well: > > [[[self webView] window] addChildWindow:[[theDocument webView] window] > ordered:NSWindowAbove]; > > > > I'm getting something wrong in the way I'm looking at this problem. > What am I not seeing? > > > > Thanks, > -s > > > > > On Thu, Jul 31, 2008 at 1:01 PM, Sumner Trammell > <[EMAIL PROTECTED]> wrote: >> Thanks Graham. >> >> I'm beginning to wonder if this will work at all? It just occurred to >> me that every time I click a popup-type link in my webView, that popup >> is itself a new instance of MyDocument. I don't see how I could add >> that popup window as a child of the main window when they are separate >> document instances. I hope I am looking at this wrong. >> >> >> A few sanity checks: >> >> aSender is the child webView >> [aSender window] is the child webView's window >> theDocument is the child webView's document >> [[theDocument webView] window] is the child webView's document's >> window (say that fast!) >> >> self is the parent document (class MyDocument) >> [self webView] is the parent document's webView >> [[self webView] window] is the parent document's webView's window >> >> >> In my mind, I want to add the child window to the parent one: >> >> [[[self webView] window] addChildWindow:[[theDocument webView] window] >> ordered:NSWindowAbove]; >> >> >> I'll try this shortly. >> >> >> Thanks, >> -s >> >> >> On Thu, Jul 31, 2008 at 1:43 AM, Graham Cox <[EMAIL PROTECTED]> wrote: >>> NSDocument doesn't implement -window >>> >>> I think you're getting muddled about what "sender" is and the relationship >>> between the document and other objects. Using addChildWindow: should be OK, >>> once you've sorted this out. >>> >>> hth, >>> >>> Graham >>> >>> On 31 Jul 2008, at 2:51 pm, Sumner Trammell wrote: >>> >>>> but it doesn't work. I get *** -[MyDocument window]: unrecognized >>>> selector sent to instance 0x1613ab30 in the run log. >>> >>> >> > _______________________________________________ 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]