Re: Can't restore first responder when restoring window state
Re: Can't restore first responder when restoring window state
- Subject: Re: Can't restore first responder when restoring window state
- From: Quincey Morris <email@hidden>
- Date: Thu, 16 Feb 2017 13:02:46 -0800
On Feb 16, 2017, at 12:43 , David Catmull <email@hidden> wrote:
>
> I looked through the documentation, and didn't see anything that says you shouldn't call those methods.
Well, “encodeRestorableStateWithCoder:"
> This method is part of the window restoration system and is called at appropriate times to save the visual state of your responder to the specified archive.
>
> Subclasses can override this method and use it to restore any information that would be needed to restore the responder to its current state. […] You must store enough data to reconfigure the responder and return it to its current state during a subsequent launch of the application.
It’s part of the window restoration system, not your functionality. It’s called [by the window restoration system] at appropriate times.
> If they were meant to be overridden and not called, I expect they'd use something more opaque and special-purpose than NSCoder.
I don’t see why you make that argument. By using standard archiving, the window restoration system thereby defines the limits of the archived representations you can use for custom information (i.e. plist types, basically).
> As for being called twice, I don't see a problem, since they'll just be restored to the same values both times.
Yes, but when you call them, restoration isn’t in progress, or is in progress but not dealing with saved information. It’s not an appropriate time.
I can understand why you thought this might be a convenient hook. I’m just saying it isn’t the hook you thought it was, so weird consequences are not entirely unexpected.
_______________________________________________
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