Re: Centering a window on the *current* screen, not the *main* screen
Re: Centering a window on the *current* screen, not the *main* screen
- Subject: Re: Centering a window on the *current* screen, not the *main* screen
- From: Oleg Krupnov <email@hidden>
- Date: Tue, 26 Jan 2010 14:25:08 +0200
Thanks Graham,
>
> You need to consider what this really means. For example, what if a window is placed so appears on more than one monitor at the same time?
>
> Actually, NSWindow already works this out - its -screen method returns the screen it mostly is placed on (i.e. contains the largest intersected area). That's handy.
>
I have actually considered this, and yes, I want my window to center
on the screen returned by [NSWindow screen].
>> I could write my own code to position the window, but I don't know how
>> to reproduce the recommended position of the centered window, which is
>> slightly above the center.
>
>
> Traditionally, this has been at a position leaving one third of the space above and two thirds below, though I'm not sure if that's still currently the exact placing.
>
You are right, except that, according to my experiment, it is one
fourth above and three fourths below.
I have written that code and it works identical to [NSWindow center],
as far as I can see. But maybe there are still caveats I'm unaware of.
Anyway, it's an annoyance that the [NSWindow center] uses [NSScreen
mainScreen] instead of [NSWindow screen]. I'd consider it a bug of
AppKit, indeed.
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