Arg! Document window restoration. Again.

Steve Mills

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.

Every time I need to do something beyond the basics with window restoration, I dread it because I know it will suck.

Steve Mills
Drummer, Mac geek

Join to automatically receive all group messages.