• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Window "snapping" to main screen
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Window "snapping" to main screen
      • From: Eric Matecki <email@hidden>
  • Prev by Date: Re: Are there any way to update NSPanel content during dragging the panel ?
  • Next by Date: Re: Are there any way to update NSPanel content during dragging the panel ?
  • Previous by thread: Re: NSTableView doesn't show data until I click on a header
  • Next by thread: Re: Window "snapping" to main screen
  • Index(es):
    • Date
    • Thread