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 09:04:28 -0800
On Nov 14, 2008, at 8:22 AM, Michel Schinz wrote:
This seems to work relatively well, except that the NSButton
instance does not react to mouse events. For example, it does not
perform the action or toggle its state when I click on it. Instead,
my layer-hosted view gets the event (i.e. its mouseDown: method gets
invoked). I found a partial work-around, which consists in calling
"performClick:" on the button whenever its layer is the one under
the mouse when the click happens, but this is not satisfactory (e.g.
the button does not highlight when the mouse hovers over it, even
though it should, given how it's configured).
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.
--
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