• 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
Re: Window Placement
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Window Placement


  • Subject: Re: Window Placement
  • From: "John C. Randolph" <email@hidden>
  • Date: Sun, 10 Nov 2002 16:42:41 -0800

On Thursday, November 7, 2002, at 04:43 PM, Ondra Cada wrote:

On Thursday, November 7, 2002, at 06:21 , Jonathan E. Jackel wrote:

NSScreen *screen = [NSScreen mainScreen];
NSRect d = [screen frame];
NSRect newRect;
newRect.size.height = 500;
newRect.size.width = 700;
newRect.origin.x = d.size.width/2 - newRect.size.width/2;
newRect.origin.y = d.size.height/2 - newRect.size.height/2;
[[winControl window] setFrame:newRect display:NO];

You could also use the NSMakeRect() function to set up the new frame.

You could also use -[NSWindow center] ;)

The only trouble with that, is that -center places the window a bit higher than the center of the screen.

-jcr


John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
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.

  • Follow-Ups:
    • Re: Window Placement
      • From: Kevin Callahan <email@hidden>
References: 
 >Re: Window Placement (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: MIME/creators
  • Next by Date: Re: [Repost] Subclassing NSTableColumn
  • Previous by thread: Re: Window Placement
  • Next by thread: Re: Window Placement
  • Index(es):
    • Date
    • Thread