Re: Window Placement
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.