Re: Centering a resized sheet
Re: Centering a resized sheet
- Subject: Re: Centering a resized sheet
- From: Shaun Wexler <email@hidden>
- Date: Fri, 14 Feb 2003 16:46:08 -0800
On Friday, February 14, 2003, at 04:21 PM, Jan Van Tol wrote:
List,
I have some code to resize a sheet, but I can't figure out how to
reliably keep the sheet in the center of it's parent window. I've
tried several approaches, but nothing seems to work 100% of the time.
If anyone has code to keep a sheet centered, I'd be very grateful.
-Jan Van Tol
This centers a window to fit an existing sheet. You could transpose
the code...
NSRect frame = [window frame];
NSSize sheetSize = [sheet frame].size;
float titleHeight =
actual_calculated_height_of_window_titlebar_from_frame_style;
[window setFrame:NSMakeRect(frame.origin.x + (frame.size.width -
sheetSize.width) / 2.0f, frame.origin.y + frame.size.height -
sheetSize.height - titleHeight, sheetSize.width, sheetSize.height +
titleHeight) display:YES];
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
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.