Re: NSWindow not restoring location
Re: NSWindow not restoring location
- Subject: Re: NSWindow not restoring location
- From: Matt Neuburg <email@hidden>
- Date: Sat, 13 Jul 2002 09:01:33 -0700
On Thu, 11 Jul 2002 03:42:25 -0500, Brock Brandenberg
<email@hidden> said:
>
to restore the exact position of singleton windows and panels like inspector
>
palettes. I searched the archives to try and connect the problem and
>
solution, but couldn't find a mention of them together (much less any
>
confirmed solution to this problem).
>
>
When trying to restore the location of a window from the default plist using
>
[window setFrameUsingName:], sometimes your window location will be restored
>
properly and sometimes it will not. This is because the window controller
>
wants to insure that a window lies completely within the [NSScreen
>
visibleFrame], and it will do whatever is necessary to make this happen when
>
it's given the responsibility of positioning the window. Herein lies the
>
key
My approach, rather than trying to second-guess this mechanism, is to
bypass it. Instead of using the window's autosaveName, I save the window's
frame myself when it closes and restore it myself when it opens. If that
means it's partly off the screen, it's up to me to deal with that - or not.
You can see this technique at work in my MemoryStick app. Normally the
window insists on being in some screen's visibleFrame. But if you
option-drag the window partway off the screen, all bets are off; I turn off
the repositioning mechanism, and if you then quit, then the next time you
start up the app, the window will be in the same place, partway off the
screen. m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.