Thank you very much for the help.  Your suggestion works.

I was confused because the NSWindows  method ignoresMouseEvents returns false 
after I initialize  the window.  So the calling of the setIgnoresMouseEvents 
must have some other side effect.

Maybe the documentation needs to be  updated to be more clear on the side 
effect.

Regards,

Marshall

On Jan 31, 2012, at 11:24 PM, Ron Fleckner wrote:

> 
> On 01/02/2012, at 7:59 AM, Marshall Houskeeper wrote:
> 
>> I would like to create a transparent  window that spans all the screens and 
>> that handles mouse down events.   Below is the code that I use to create my 
>> transparent window.  The transparent window gets created and display 
>> successfully.  However, mouse down events are not directed to the window.  I 
>> can see where this feature is desirable. For example making a round window.  
>>  However, not in my case.
>> 
>> Is there a way that I can setup a transparent  window to receive mouse down 
>> events?
>> 
>> Note: I have found that if I set the window's background color alpha value 
>> to 0.05 or greater I will receive mouse down events.   However this little 
>> amount of alpha causes some color shift in the background image.
>> 
>> - (id)init
>> {
>>      NSRect rect = [[NSScreen mainScreen] frame];
>>      
>>      // get the union of all the screens
>>   for (NSScreen* s in [NSScreen screens])
>>     {
>>       rect = NSUnionRect(rect,[s frame]);
>>     }
>>      
>>   self = [super initWithContentRect:rect styleMask:NSBorderlessWindowMask 
>> backing:NSBackingStoreRetained defer:YES];
>> 
>>   if (self)
>>     {
>>          [self setBackgroundColor:[NSColor clearColor]];
>>          [self setOpaque:NO];
>>     }
>> 
>>    return self;
>> }
>> 
> 
> Hi,
> 
> NSWindow has:
> 
> setIgnoresMouseEvents:
> 
> Specifies whether the window is transparent to mouse clicks and other mouse 
> events, allowing overlay windows.
> 
> - (void)setIgnoresMouseEvents:(BOOL)ignoreMouseEvents
> 
> Parameters
> 
> ignoreMouseEvents
> 
> If YES, the window will ignore mouse events; if NO, it will not.
> 
> Availability
> 
>       • Available in Mac OS X v10.2 and later.
> 
> Ron
> 
> 
> 



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to