On Mon, Sep 19, 2016, at 10:07 PM, Quincey Morris wrote:
> On Sep 19, 2016, at 18:10 , mail...@ericgorr.net
> <mailto:mail...@ericgorr.net> wrote:
> > 
> > The strange behavior I am now seeing is that when I show & hide the panel 
> > using the buttons are what appears to be two (not three, not four, etc.) 
> > different instances of the inspector panel. The autosave information only 
> > appears to apply to one but not the other.
> 
> A couple of things:
> 
> 1. You’re keeping the panel window instance reference in
> InspectorWindowController.sharedInstance, but not keeping a reference to
> its window controller. That causes its window controller to be
> deallocated early, although that likely has nothing to with the rest of
> the problem, since the panel doesn’t have any custom behavior yet. You
> should keep a reference to the window controller instead, and that will
> keep the panel alive too.
> 
> 2. You’re doing a “performClose” to hide the panel. If you do an orderOut
> instead, you get the behavior you want.
> 
> Note that you are getting a new instance of the panel because the window
> segue mechanism decides the first one has disappeared. Again because it’s
> not documented how window segues work, there’s no way of knowing what the
> “correct” behavior is supposed to be. (Your panel window is correctly set
> to “Single” mode in the storyboard, which is what’s supposed to prevent
> multiple instances from appearing.)
> 
> Also undocumented — forever AFAIK although others on this list may know
> more about this — is what a window “close” (or “performClose”) does,
> other than ordering out the window and (if it’s set to release on close)
> to release it.

-performClose: is documented to highlight the Close button, so that it
is highlighted if any “unsaved changes” confirmation sheets are
displayed. That helps the user understand what will happen to the
document window if they confirm the Save panel.

-close asks the window’s delegate (via -windowShouldClose:) if it should
close. If the window is owned by a window controller that’s associated
with a document, the document will also get a chance to weigh in via
-shouldCloseWindowController:…. It will also send
NSWindowWillCloseNotification.

-orderOut: just hides the window (removes it from the window list). You
can always order it back in again later.

--Kyle Sluder

> Whatever a “close” actually does, it’s making the
> storyboard mechanism unable to find the panel instance, so it creates a
> new one. (Your panel is *not* set to release on close, and I was able to
> verify that it’s not being released regardless, so this is not anything
> you appear to be doing wrong.)
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/kyle%40ksluder.com
> 
> This email sent to k...@ksluder.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to