Re: Not receiving mouseDown/Up events in borderless window . . . (Solved!)
Re: Not receiving mouseDown/Up events in borderless window . . . (Solved!)
- Subject: Re: Not receiving mouseDown/Up events in borderless window . . . (Solved!)
- From: "Michael A. Crawford" <email@hidden>
- Date: Thu, 17 Sep 2009 13:22:57 -0400
Apparently on Leopard (and presumably, early versions of Mac OS X) you
have to handle the mouseDown event in order to receive a mouseUp
event. Initially, I only overrode mouseUp, thinking that I didn't
want to react to the event until the user releases the mouse button
inside the NSRect of interest. This little obscure fact didn't appear
in any of the texts or web pages I had scanned. I only guessed at the
solution when I overrode and observed the behavior of - (void)
sendEvent:(NSEvent*)event on both Leopard and Snow Leopard. On Snow
Leopard, calling -[super sendEvent:event] was quickly followed by a
call to -[mouseUp:event]. On Leopard it is not.
-Michael
On Sep 14, 2009, at 2:47 PM, Michael A. Crawford wrote:
Ok. I went back and did some experimenting and it doesn't look
good. First of all the ignoresMouseEvents property was already set
to NO. Assuming I had some issue with intercepting mouse clicks at
the NSWindow level when an NSView was present, I decided to
implement support for event handling in my NSView derived class.
Again the code works but only on Snow Leopard. On 10.5 I'm just not
seeing those mouse clicks.
When I say 'not seeing' I'm talking about empirical evidence. My
software doesn't respond by closing the windows or doing anything
else I've programmed it to do when the mouse is clicked in one of my
views. My tester is reporting the same problem when he runs the
code on his 10.5 system.
I'm building this code on 10.6 with Xcode 3.2. This is my
development machine, which I foolishly upgraded. I no longer have a
Leopard development system running Xcode 3.1. How can I see what is
going on on my Leopard test system? I'm building using the 10.5 SDK
since I want my app to run on both 10.5 and 10.6 as a 32-bit app.
With a debug build, is there anyway to see debug console output on
my test machine running the binary I build using Xcode 3.2?
Obviously this is my problem. If it were the case than anyone
processing events in windows and views on 10.5 using a binary built
on 10.6 with Xcode 3.2, I would have heard about it.
In case you are curious, here is the experimental code.
@class CDImageView;
@protocol CDImageViewDelegate
- (void)mouseUp:(NSEvent*)event onImageView:(CDImageView*)imageView;
@end
@interface CDImageView : NSImageView
{
id<CDImageViewDelegate> delegate;
}
@property (nonatomic, assign) id<CDImageViewDelegate> delegate;
@end
@implementation CDImageView
@synthesize delegate;
- (void)mouseUp:(NSEvent*)event
{
[self.delegate mouseUp:event onImageView:self];
}
@end
-Michael
On Sep 12, 2009, at 10:36 PM, Ken Thomases wrote:
On Sep 12, 2009, at 9:12 PM, Michael A. Crawford wrote:
I have created a borderless window that is used to display a
custom graphic, which need to respond to the enter key or a mouse
click by closing itself. Seems straightforward enough. It works
great on Snow Leopard (10.6) but I do not get the mouse events on
Leopard (10.5). Hitting the enter key works on both.
Anyone seen this behavior before? I've included the code so you
could see if I've left something out.
I think you need to setIgnoresMouseEvents:NO. I believe that
windows which are transparent below a certain threshold ignore
mouse events by default.
Regards,
Ken
_______________________________________________
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
_______________________________________________
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