• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Transparent window not getting mouse down events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transparent window not getting mouse down events


  • Subject: Re: Transparent window not getting mouse down events
  • From: Marshall Houskeeper <email@hidden>
  • Date: Wed, 01 Feb 2012 07:59:59 -0500

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 (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


  • Follow-Ups:
    • Re: Transparent window not getting mouse down events
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: iOS API
  • Next by Date: RE: Selected text in NSTextField
  • Previous by thread: Re: iOS API
  • Next by thread: Re: Transparent window not getting mouse down events
  • Index(es):
    • Date
    • Thread