• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problems with mouse events
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Problems with mouse events
      • From: Ryan Stevens <email@hidden>
  • Prev by Date: Re: Custom table header scroll-bar bug
  • Next by Date: Re: Sorting Attributed Strings w/Bindings
  • Previous by thread: Re: Custom table header scroll-bar bug
  • Next by thread: Re: Problems with mouse events
  • Index(es):
    • Date
    • Thread