Re: Button frame to screen rect
Re: Button frame to screen rect
- Subject: Re: Button frame to screen rect
- From: Fritz Anderson <email@hidden>
- Date: Tue, 13 Apr 2010 09:42:03 -0500
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