Problems with mouse events
Problems with mouse events
- Subject: Problems with mouse events
- From: Sam Wilkins <email@hidden>
- Date: Sat, 20 Nov 2004 22:23:35 -0500
I was hoping one of you could answer a few questions I have.
- (void)mouseEntered:(NSEvent *)theEvent
{
oldAcceptsMouseMovedEvents = [[self window] acceptsMouseMovedEvents];
oldNextResponder = [[[self window] nextResponder] retain];
[[self window] setAcceptsMouseMovedEvents:YES];
[self setNextResponder:oldNextResponder];
[[self window] setNextResponder:self];
}
- (void)mouseExited:(NSEvent *)theEvent
{
[[self window] setAcceptsMouseMovedEvents: oldAcceptsMouseMovedEvents];
[[self window] setNextResponder:[oldNextResponder autorelease]];
[self setNextResponder:[self superview]];
[self setPageNumberHighlightFlags:APHighlightNone];
[self displayIfNeeded];
oldNextResponder = nil;
}
Some guy who didn't want to respond to the list because he didn't want
spammers getting his email found this code for me. Unfortunately, the
NSScrollView in which this view resides has stopped receiving
scrollWheel events. I cannot figure out where to insert myself into the
responder chain so that selected text fields get key events, my scroll
view gets scrollWheel events (the only thing I can think of to do
causes an instant crash whenever keyDown is generated (with over 10,000
recursive calls to -[NSViewRectCache cacheRect:] on the stack!), which
also includes holding shift to modify scroll wheel behaviour) and my
view gets every other mouse related event.
My next problem is that often the mouse is already inside the rect when
the window is first displayed. Do you have any suggestions for forcing
a mouseEntered event to be generated if that's the case?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden