Re: Getting Mouse Moved Events
Re: Getting Mouse Moved Events
- Subject: Re: Getting Mouse Moved Events
- From: Michael Latta <email@hidden>
- Date: Sat, 28 Dec 2002 08:20:07 -0800
Matthew,
Thanks for the pointer on needing to be first responder. This is no
where in the documentation!!
This also REALLY REALLY REALLY sucks!! I wanted to track the mouse
even when not the active application to do some highlighting. I guess
I will need to try tracking regions/rectangles. If you know of
restrictions on that that are not document please let me know to reduce
the blood on the brick wall (from my head).
Michael
On Saturday, December 28, 2002, at 01:33 AM, Matthew wrote:
Michael -
If you havent already figured it out - Im betting that you arent
getting mouseMoved events because your view isn't the first responder.
Make a NSView in your window and subclass it - and make sure that it
is the first responder. Test to make sure that the window is getting
the setAcceptsMouseMovedEvents message ok. It seems like you shouldnt
have to be the first responder to get mouse moved events - I could see
where you might want to track them in views that arent the fr - but
thats the way it is.
(from within your NSView subclass' awakeFromNib method - if you are
using nibs)
- (void)awakeFromNib
{
[[self window] makeFirstResponder: self];
[[self window] setAcceptsMouseMovedEvents: YES];
if ([[self window] acceptsMouseMovedEvents]) {NSLog(@"window now
acceptsMouseMovedEvents");}
}
- (void)mouseMoved: (NSEvent *)theEvent {
NSLog(@"mouseMoved working");
}
- (BOOL) acceptsFirstResponder {
return YES;
}
cheers,
Matthew
On Friday, December 27, 2002, at 04:33 PM, Michael Latta wrote:
I have a document based application that wants to receive mouse moved
events for one of the views in the main document window.
I have tried using [aWindow setAcceptsMouseMovedEvents: YES] in about
all the places I can think of.
Setting this in awakeFromNib seems to set it, then later when trying
to set it again in viewDidMoveToWindow it is unset and will not take
being set (as verified by a getAcceptsMouseMovedEvents immediately
following. On other cases it claims to be set in all cases, but
still delivers no events.
Is the default window controller fighting me on this?
Any suggestions welcome. In the old DPS days this was the window
event mask that could be set easily to deal with this type of thing.
Michael Latta
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.