Re: Position a window in center & under the menubar.
Re: Position a window in center & under the menubar.
- Subject: Re: Position a window in center & under the menubar.
- From: Paul Lynch <email@hidden>
- Date: Wed, 14 Jun 2006 15:48:38 +0100
On 12 Jun 2006, at 17:07, Mohsan Khan wrote:
I have a window which I want in center of the screen and under the
menubar with some offset from the menubar.
----------------------------------------------------------------------
--------------
// center the window
[mMainWindow center];
// place at top, under the menu
NSRect screenRect = [[NSScreen mainScreen] frame]; // get the
screen rect of our main display
Use -visibleFrame.
NSRect windowRect = [mMainWindow frame];
NSPoint p = windowRect.origin;
p.y = screenRect.size.height - [NSMenuView menuBarHeight] -20; //
screen size from bottom to top
[mMainWindow setFrameOrigin: p];
----------------------------------------------------------------------
--------------
This puts the window in center just under the menubar, but the -20
offset does not apply.
The offset applies if I set -70, then there seems to be a 10 pixel
offset from the menubar.
My question, what am I doing wrong here?
Why doesn't -20 apply?
The doc comments on visibleFrame should help.
Paul
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden