• 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: Centering a resized sheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Centering a resized sheet (From: Jan Van Tol <email@hidden>)

  • Prev by Date: Re: iCal calendar parser
  • Next by Date: Pixel Drawing Program
  • Previous by thread: Centering a resized sheet
  • Next by thread: Pixel Drawing Program
  • Index(es):
    • Date
    • Thread