• 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: Adding an NSButton to a layer-hosted view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding an NSButton to a layer-hosted view


  • Subject: Re: Adding an NSButton to a layer-hosted view
  • From: David Duncan <email@hidden>
  • Date: Fri, 14 Nov 2008 11:01:51 -0800

On Nov 14, 2008, at 10:33 AM, Michel Schinz wrote:

Le 14 nov. 08 à 18:04, David Duncan a écrit :

AppKit doesn't do hit testing via the layer tree, so by moving the button's layer, you've desynchronized the graphical location of the button with the hit test location of the button. If you want to use layer-backed AppKit views, you always need to move them via AppKit for the graphical and logical locations to match.

That was the problem indeed, thanks a lot David! Moving the button using setFrameOrigin: makes it behave correctly.


I'll also conclude from your answer that putting these NSControl instances in my layer-hosted view is legal. Please correct me if I'm wrong.


It is legal, and AppKit tries to make sure that nothing bad will happen (i.e. you shouldn't crash). In general however, its an easier programming model if you either work entirely with Views or entirely with Layers. You can mix them, but you have to be careful about what your doing. Graphical attributes usually aren't a problem, but geometrical ones can be (as you've already found out).
--
David Duncan
Apple DTS Animation and Printing


_______________________________________________

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


References: 
 >Adding an NSButton to a layer-hosted view (From: Michel Schinz <email@hidden>)
 >Re: Adding an NSButton to a layer-hosted view (From: David Duncan <email@hidden>)
 >Re: Adding an NSButton to a layer-hosted view (From: Michel Schinz <email@hidden>)

  • Prev by Date: Re: Unable to generate a PDF from textual data
  • Next by Date: Re: Unable to generate a PDF from textual data
  • Previous by thread: Re: Adding an NSButton to a layer-hosted view
  • Next by thread: CALayer and View
  • Index(es):
    • Date
    • Thread