Re: Button frame to screen rect
Re: Button frame to screen rect
- Subject: Re: Button frame to screen rect
- From: Jack Carbaugh <email@hidden>
- Date: Tue, 13 Apr 2010 12:28:32 -0400
Thanks for your help.
From this then, I would use the origin point ... of the bounds or
frame of the button rect, which would give me the equivalent in screen
coordinates and then just adjust the width/height as necessary for my
window ?
Again, my thanks
On Apr 13, 2010, at 10:42 AM, Fritz Anderson wrote:
On 13 Apr 2010, at 5:30 AM, Jack Carbaugh wrote:
What would be the easiest way to convert the frame rect of a button
in a window to a screen rect ?
Search the documentation for symbols beginning with "convert"; among
the results:
convertBaseToScreen:
Converts a given point from the window’s base coordinate system to
the screen coordinate system.
- (NSPoint)convertBaseToScreen:(NSPoint)point
Parameters
point
The point expressed in the window’s base coordinate system.
Return Value
point expressed in screen coordinates.
Availability
• Available in Mac OS X v10.0 and later.
It converts NSPoints, but you can do the math. You may want to start
with the bounds rect of the button, and use -[NSView
convertPoint:toView:] with the second argument nil; it will keep
working if you ever move the button to an enclosing view.
— F
_______________________________________________
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