Re: Adding an NSButton to a layer-hosted view
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