• 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
Re: Unresponsive mouseMoved method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unresponsive mouseMoved method


  • Subject: Re: Unresponsive mouseMoved method
  • From: Bob Smith <email@hidden>
  • Date: Wed, 28 Mar 2007 17:49:29 -0700

The window delegate cannot handle mouse events because those do not follow the responder chain as do actions; mouse events are sent by the window to the view in which the event occurred, and nowhere else. You have done the correct thing by extending your view class, and I don't see anything wrong with your solution.

Hope this helps!

Bob S.

On Mar 28, 2007, at 5:29 PM, Steve Bryan wrote:

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

_______________________________________________

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


  • Follow-Ups:
    • Re: Unresponsive mouseMoved method
      • From: "Shawn Erickson" <email@hidden>
References: 
 >Unresponsive mouseMoved method (From: "Steve Bryan" <email@hidden>)

  • Prev by Date: Unresponsive mouseMoved method
  • Next by Date: Re: Unresponsive mouseMoved method
  • Previous by thread: Unresponsive mouseMoved method
  • Next by thread: Re: Unresponsive mouseMoved method
  • Index(es):
    • Date
    • Thread