Re: How does a fully transparent window receive mouse event?
Re: How does a fully transparent window receive mouse event?
- Subject: Re: How does a fully transparent window receive mouse event?
- From: Ron Fleckner <email@hidden>
- Date: Tue, 25 Dec 2007 21:20:54 +1100
Hi James,
There might be, and probably is, a better way, but if you set the
window's color to white with an alpha value of 0.05, it's *almost*
invisible and yet still receives mouse clicks. I tried this:
NSRect screenRect = [[NSScreen mainScreen] frame];
NSWindow *clearWindow = [[NSWindow alloc]
initWithContentRect:screenRect styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered defer:NO];
[clearWindow setBackgroundColor:[NSColor colorWithDeviceWhite:1.
alpha:.05]];
[clearWindow setOpaque:NO];
[clearWindow setLevel:NSScreenSaverWindowLevel];
[clearWindow makeKeyAndOrderFront:self];
and it sort of does the trick.
Ron
On 25/12/2007, at 8:50 PM, James Chen wrote:
You are right.
1. I create a window, _MainWindow, with style NSBorderlessWindowMask.
2. And then
[_MainWindow makeKeyAndOrderFront:self];
[_MainWindow setOpaque:NO];
[_MainWindow setBackgroundColor:[NSColor clearColor]];
That's it. :)
Best Regards,
James Chen
From: Uli Kusterer <email@hidden>
Date: Tue, 25 Dec 2007 10:41:12 +0100
To: James Chen <email@hidden>
Cc: Cocoa <email@hidden>
Subject: Re: How does a fully transparent window receive mouse event?
Am 25.12.2007 um 8:24 schrieb James Chen:
I do know how to create a transparent window with alpha value 0.
But seems window server never send me the mouse event when the
window is
fully transparent.
Maybe you only think you know? How exactly are you doing it? Maybe
there's something wrong with the way you're making your window
transparent. Post some code.
Cheers,
-- M. Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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:
40ozemail.com.au
This email sent to email@hidden
_______________________________________________
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