Window "snapping" to main screen
Window "snapping" to main screen
- Subject: Window "snapping" to main screen
- From: Eric Matecki <email@hidden>
- Date: Thu, 03 May 2012 10:27:43 +0200
Hi everybody,
I have two screens on my MacPro (10.7.3)
When opening a window with the following code :
// create a reference rect
NSRect contentSize = NSMakeRect( iX, iY, iW, iH );
// allocate window
NSUInteger styleMask =
NSTitledWindowMask |
NSClosableWindowMask |
NSMiniaturizableWindowMask |
NSResizableWindowMask;
mWindow = [[NSWindow alloc] initWithContentRect: contentSize styleMask: styleMask backing: NSBackingStoreBuffered defer: YES];
Cocoa_WindowDelegate* delegate = [[Cocoa_WindowDelegate alloc] init];
[mWindow setDelegate: delegate];
// show window
[mWindow makeKeyAndOrderFront: mWindow];
[mWindow makeMainWindow];
where iX,iY,iW,iH are the wanted position and w/h of the window, the window always "snaps" to the main screen.
It's y,w,h are correct, but x is adjusted so the window either fits entirely on the main screen (flush at the right border), or if
it's too wide, x is set to 0. Even if the asked for position is entirely on the second screen and doesn't straddle the boundary
between the screens.
Other apps don't have this problem.
What am I doing wrong or what did I forget to do ?
Thanks for your help.
--
Eric M.
_______________________________________________
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