Centering a window ... not in the usual way!
Centering a window ... not in the usual way!
- Subject: Centering a window ... not in the usual way!
- From: Mic Pringle <email@hidden>
- Date: Wed, 13 May 2009 09:20:42 +0100
Hi,
I'm working on an application that when first started you are
presented with a small window showing a number of options. When any of
these options are chosen, the window fades out the contentView whilst
at the same time replacing it with and fading in the new view. The
window also resizes to accommodate the new view. This is all achieved
using NSViewAnimation and works and looks great. However, I have one
small issue.
What I'd like is for the resulting window (new size, containing new
view) to be centered on the screen, in the sameplace as if I'd called
[window center] on it.
I currently have it centering using some calculations based on screen
width/height and window width/height etc but this results in it being
actually centered on the screen, not centered in which the above call
does (They are different, honest, check them out).
What I thought about doing was creating a transparent window using a
border less mask, the same size as the resulting window, calling
center on it, and then getting the frame rect. This could be done in
awakeFromNib and then released and would be unknown to the user.
However the issues here are that a border less window obviously has
not title bar, so how can I take that in to account ? Also I would
like the resulting window to have a toolbar, where as the small window
first displayed doesn't, so again how can I take this in to account ?
Are there standard sizes I can apply for title bars and toolbars, as
these could be added to the border less window frame before calling
center ?
Any help would be greatly appreciated.
-Mic
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden