Re: Clicking through a NSView with CALayers
Re: Clicking through a NSView with CALayers
- Subject: Re: Clicking through a NSView with CALayers
- From: Rowan Nairn <email@hidden>
- Date: Sat, 25 Apr 2009 19:08:30 -0700
On Sat, 25 Apr 2009 at 17:26 AM, Bill Cheeseman <email@hidden> wrote:
> I have an identical setup on an application I'm currently working on,
> and clickthrough works just fine for me.
Really? I hope we're talking about the same thing here. I just
created a new blank Cocoa Application, and changed the window to a
custom class with this initialization code:
@implementation MyWindow
- (void)awakeFromNib {
[self setOpaque:NO];
[self setBackgroundColor:[NSColor clearColor]];
[[self contentView] setLayer:[CALayer layer]];
[[self contentView] setWantsLayer:YES];
CALayer* layer = [CALayer layer];
layer.frame = CGRectMake(10, 10, 100, 100);
layer.borderWidth = 3;
[[[self contentView] layer] addSublayer:layer];
}
@end
The transparent areas of the window intercept clicks. Do you see
different behavior? How would you change the above code to make the
transparent areas also transparent to clicks?
> My window is borderless and transparent, its entire area is covered by
> an empty contentview and also by a CALayer with various sublayers.
> When I turn clickthrough on and off, the application behaves as
> expected. My contentview is set up as a layer-hosted view, not a layer-
> backed view, in case that makes a difference.
What do you mean by "turn clickthrough on and off"? Just to
reiterate, I'm talking about clicking through to *other* application
windows beneath my window. I'm not talking about [view
acceptsFirstMouse:YES] type of click-through.
Thanks for the help,
Rowan
_______________________________________________
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