• 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
How can I display a window to the second screen if there are multiple screens?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How can I display a window to the second screen if there are multiple screens?


  • Subject: How can I display a window to the second screen if there are multiple screens?
  • From: Marc Liyanage <email@hidden>
  • Date: Fri, 16 Aug 2002 01:15:15 +0200

Hi there,

I want to pop up several windows, one per attached screen on the machine.

I first created the windows all programmatically and was able to get the results I wanted by using
- initWithContentRect:styleMask:backing:defer:screen:

I was passing a rect with a constant offset from the top left corner, and a screen parameter I got by looping through [NSScreen screens].

This worked, I got my windows near the upper left corners of my two screens.



However, for other reasons I decided to create the windows from a .nib file instead of programmatically.
The problem I seem to have now is that I cannot position a window onto the second screen.

I am reading out screen coordinates with CGGetActiveDisplayList() and CGDisplayBounds()

This gives me two rects for my two screens:
Display 1 ({{0, 0}, {1280, 854}})
Display 2 ({{1280, 0}, {1024, 768}})

I then tried to use these to calculate the positions for the two windows, but they always end up on the main screen.

In another setup, the second display is to the left instead of to the right of my main screen and the second display's x origin is negative.
The problem is that I cannot move the second window to the second screen with - setFrame:display:, it always stays on the main screen, near the other window.

Ideally I would like to call the - center method, btw., to center the two windows on their respective screens after they've been moved there...



How can I do this?

_________________________________________________________________
Marc Liyanage email@hidden
http://www.entropy.ch
ICQ 5077985

Yoda I am. Grammar I can't.
_________________________________________________________________
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: NSTask and avoiding buffered standard out (From: Ingvar Nedrebo <email@hidden>)

  • Prev by Date: Contextual Menu like the Dock's
  • Next by Date: (Mis?)Usage of NSFileHandle
  • Previous by thread: Re: NSTask and avoiding buffered standard out
  • Next by thread: NSTask taking too long...
  • Index(es):
    • Date
    • Thread