• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Making child windows move with their parents
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Making child windows move with their parents


  • Subject: Making child windows move with their parents
  • From: "Sumner Trammell" <email@hidden>
  • Date: Thu, 31 Jul 2008 00:51:12 -0400

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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Making child windows move with their parents
      • From: Jens Alfke <email@hidden>
    • Re: Making child windows move with their parents
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Dragging a header file to XIB Dock
  • Next by Date: Bindings to simulate spreadsheet functions in NSTableView?
  • Previous by thread: Re: Document based initial window.
  • Next by thread: Re: Making child windows move with their parents
  • Index(es):
    • Date
    • Thread