Re: How to save/restore the screen of the window in user defaults?
Re: How to save/restore the screen of the window in user defaults?
- Subject: Re: How to save/restore the screen of the window in user defaults?
- From: Mike Abdullah <email@hidden>
- Date: Mon, 25 Jan 2010 14:55:29 +0000
On 25 Jan 2010, at 13:59, Oleg Krupnov wrote:
> Hi,
>
> I'd like my app's main window to appear on the same screen where it
> was last closed, on a multi-monitor Mac. How do I do this?
>
> I checked the docs and found that I could use [[[window screen]
> deviceDescription] objectForKey:@"NSScreenNumber"] as a unique
> identifier that is permanent across system reboots. Good.
>
> But how do I restore the window on that screen? The [window screen]
> property is read-only. There is [window
> initWithContentRect:styleMask:backing:defer:screen:], but the doc is
> rather vague how to use it. So how do I change the screen where the
> window is appearing? Or maybe I should simply move the window origin?
> But in that case, how the coordinate systems of the different screens
> are welded together?
There is a single coordinate system that encompasses all screens attached to the computer. Do not worry about the screen the window is on, just the coordinates. Easiest way to do this is tell the owning window controller to autosave the window frame.
>
> It's especially hard for me because I don't have a multi-monitor Mac
> at my disposal to experiment with.
>
> Thanks!
> _______________________________________________
>
> 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
_______________________________________________
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