• 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
Re: Window layering and save sheet attachment in multi-window document
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Window layering and save sheet attachment in multi-window document


  • Subject: Re: Window layering and save sheet attachment in multi-window document
  • From: Derrick Bass <email@hidden>
  • Date: Thu, 1 Dec 2005 04:24:21 -0600


On Nov 30, 2005, at 9:06 PM, Sherm Pendley wrote:

On Nov 30, 2005, at 9:59 PM, Derrick Bass wrote:


So I tried creating the windows in the opposite order; subsidiary windows first, main window last. But there's another problem with that. The save sheet appears on the subsidiary window instead of the main window, which I don't like.


Override -windowForSheet in your NSDocument subclass.

Oh! Thanks! I love it when the answer is simple. I also hate it, because I feel stupid, but ahh well.



I have a multi-window document with a main window and several (optional, controlled by user defaults) subsidiary windows. Only the main window has shouldCloseDocument set to YES.

I'd like the main window to be in front when the user opens a document, but it appears that the last window created is always in front. I tried telling the main window to makeKeyAndOrderFront at the end of the makeWindowControllers method, but it didn't seem to do anything; stepping through the code showed that the windows don't show themselves until well after that function is over; that is presumably why makeKeyAndOrderFront is being ignored.


You could do that in -windowControllerDidLoadNib:. If you don't want the visual artifact of the windows appearing out of order, then rearranging, uncheck the "visible on startup" property in Interface Builder. That way they won't be shown until you do eventually call -makeKeyAndOrderFront:.

I'm still having trouble with this one. The "visible at launch" (which is what I presume you were referring to) was not checked for either of my windows, and they display themselves anyway.

The order seems to be:
makeWindowControllers: is called and finishes.
windowControllerDidLoadNib: is called for the first window created, and finishes.
The first window is displayed and made front.
windowControllerDidLoadNib: is called for the second window created, and finishes.
The second window is displayed and made front.

If I put a makeKeyAndOrderFront: in the windowControllerDidLoadNib: then the window is displayed at that point, before the routine finishes.

I tried creating the windows in the order main window, subsidiary window and then when windowControllerDidLoadNib: was called for the subsidiary window I called -[subWindow orderWindow:NSWindowBelow relativeTo:[mainWindow windowNumber]]. As soon as I called that, the window appeared behind the main window (hooray!) but once windowControllerDidLoadNib: exited, it became the front window.

Derrick


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: Window layering and save sheet attachment in multi-window document
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: Re: A simple question about nsthread
  • Next by Date: Re: NSBitmapImageRep and 1-bit image
  • Previous by thread: Re: more than one plist in a file.
  • Next by thread: Re: Window layering and save sheet attachment in multi-window document
  • Index(es):
    • Date
    • Thread