Position a window in center & under the menubar.
Position a window in center & under the menubar.
- Subject: Position a window in center & under the menubar.
- From: Mohsan Khan <email@hidden>
- Date: Mon, 12 Jun 2006 18:07:16 +0200
Hi
This is my first Cocoa post ever!
I just started with Cocoa, Cocoa rules!
anyway...
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
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?
Yours sincerely,
Mohsan Khan.
_______________________________________________________________
Programmer, Animator, Musician
www.xybernic.com
There is no place like 127.0.0.1.
If everybody would give everybody a million would everybody be
millionaires?
Nothing has got to do with anything, but something has got to do with
everything.
_______________________________________________
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