Unresponsive mouseMoved method
Unresponsive mouseMoved method
- Subject: Unresponsive mouseMoved method
- From: "Steve Bryan" <email@hidden>
- Date: Wed, 28 Mar 2007 19:29:13 -0500
I'm trying to discover why my mouseMoved method does not get called. I've
declared it for a controller class which is the delegate for the window. In
its awakeFromNib method I have the calls:
[mWindow setAcceptsMouseMovedEvents: YES];
[mWindow setDelegate: self];
I also have mouseMoved defined for this controller class:
- (void)mouseMoved: (NSEvent*)theEvent
{
NSLog(@"mouseMoved");
}
There is other code in there but it never gets called (ie repeated output of
"mouseMoved" in the log). If I override it in an NSView subclass it does get
called. But there are several panes and only one will be the next responder
in the chain.
While composing this query a solution has been found but it seems a bit
convoluted. I already used a category to extend NSView so I just added this
to the category:
- (void) mouseMoved: (NSEvent*)theEvent
{
[[[self window] delegate] performSelector: @selector(mouseMoved:)
withObject: theEvent];
}
Exactly one of the subviews will be active and it nicely transfers the call
over to the delegated controller class so all is well. I'm still wondering
why the original "wiring" did not work and if there is some possible defect
in my tricky solution.
p.s. My controller class is a subclass of NSReponder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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