• 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: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...


  • Subject: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • From: Graham Cox <email@hidden>
  • Date: Wed, 4 Nov 2009 00:56:37 +1100


On 04/11/2009, at 12:46 AM, Oleg Krupnov wrote:

1. in controller, determine which view the mouse currently is over
(hit test the window)
2. localize the coordinate to that view and ask the view to hit test
its items for the coordinate
3. set the controller's selection to that item

This all, and exactly this, would happen all by itself, by the already
existing code, in case if I sent the fake mouse moved event.


OK, sounds to me that all you need to do is a little factoring. Factor out the code that takes a mouse position and does the hit-testing and selection maintenance into a new method. Call this code from your mouse moved handler. Also call it with the current mouse position at the end of your animation. Job jobbed.

In other words, instead of faking a mouse event in order to get the mouse position into that code, just factor that part out and give it the mouse position at the end. You can get that using - mouseLocationOutsideOfEventStream. Converting it to local coordinates is a simple call, far simpler than trying to build a mouse event.

--Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
      • From: Uli Kusterer <email@hidden>
References: 
 >How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Oleg Krupnov <email@hidden>)
 >Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Graham Cox <email@hidden>)
 >Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Oleg Krupnov <email@hidden>)
 >Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Graham Cox <email@hidden>)
 >Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Oleg Krupnov <email@hidden>)
 >Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Graham Cox <email@hidden>)
 >Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Oleg Krupnov <email@hidden>)
 >Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Graham Cox <email@hidden>)
 >Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work... (From: Oleg Krupnov <email@hidden>)

  • Prev by Date: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • Next by Date: Handling calculations with many decimal places
  • Previous by thread: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • Next by thread: Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
  • Index(es):
    • Date
    • Thread