I'm shooting off the cuff here. But try setting up a tracking area that matches your "active" rectangle. When the mouse enters the tracking area, setIgnoreMouseEvents:NO, when the mouse exits the tracking area setIgnoreMouseEvents:YES.
-raleigh On May 31, 2011, at 1:30 AM, Ken Thomases wrote: > On May 31, 2011, at 1:33 AM, Deepa wrote: > >> I am developing an Desktop application in which I should be able to take >> mouse events on transparent window. But, transparent NSWindow does not take >> mouse events. So, I have set setIgnoreMouseEvents to NO which allows the >> transparent window to take mouse events. >> >> I have the problem in the following scenario: >> There is dynamically created rectangular shape on this window. The >> transparent window should not take mouse events in this region; it should be >> delegated to the window (of some other app) that is present behind this >> shape. >> For this purpose, if the mouseDown event is inside the shape I am setting >> setIgnoreMouseEvents to YES. Now, if the user performs mouse events in the >> area outside the shape the transparent window should take the event. Since, >> setIgnoreMouseEvents is set to YES, window does not take mouse events. >> >> There is no way to identify that mouseDown event has occurred so that I can >> set setIgnoreMouseEvents to NO. >> >> Could someone suggest me some best method to handle mouse events on >> transparent window? > > The Mac OS X Window Server has to decide where to route events. It is a > process outside of any particular application. Once it has picked which > window (and therefore application) will receive an event, that's the end of > the matter. That application chooses how to respond (including, possibly, > doing nothing), but the event won't be delivered to any other application. > > You can't dynamically choose to pass an event along to the "next" > application. (You could try to approach this using CGEventTaps, but I doubt > you'd achieve anything satisfactory.) > > The better approach is to use multiple transparent overlay windows. If you > need to make a frame that accepts mouse events around a rectangular area that > does not, you may need four transparent windows for the frame and, if > necessary, one for the interior rectangle. You can use child windows > (-[NSWindow addChildWindow:ordered:]) to make sure the windows move together. > > Regards, > Ken > > _______________________________________________ > > 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: > http://lists.apple.com/mailman/options/cocoa-dev/ledet%40apple.com > > This email sent to le...@apple.com _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com