Re: Arg! Document window restoration. Again.


Jon Gotow
 

Can't you just set NSWindow.frameAutosaveName? Or does NSDocument get in the way of that?

- Jon

On Jul 31, 2019, at 10:09 PM, Steve Mills via Groups.Io <sjmills=mac.com@groups.io> wrote:

Doc and window restoration is great when relaunching the app, but I also want each document's window to open to their last frame when the user opens documents. I can not find the right place to make that happen. I supposed I'll need to subclass the window controller or window? What I thought would work was to grab the saved restoration data (which I saved in the document by calling -encodeRestorableStateWithCoder: and specifically adding the window frame with a custom key in -window:willEncodeRestorableState:), feed the data to an NSKeyedUnarchiver, and pass that to -restoreStateWithCoder: from my document subclass' -windowControllerDidLoadNib: method. But that appears to do nothing. It doesn't even get around to calling the document's -window:didDecodeRestorableState: override.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.