• 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: Button frame to screen rect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Button frame to screen rect
      • From: Jack Carbaugh <email@hidden>
References: 
 >Button frame to screen rect (From: Jack Carbaugh <email@hidden>)

  • Prev by Date: Re: Font Style Names for iPhone/iPad
  • Next by Date: Re: Button frame to screen rect
  • Previous by thread: Button frame to screen rect
  • Next by thread: Re: Button frame to screen rect
  • Index(es):
    • Date
    • Thread