• 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: Uli Kusterer <email@hidden>
  • Date: Tue, 3 Nov 2009 18:09:00 +0100

On 03.11.2009, at 14:56, Graham Cox wrote:
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.


Also, faking mouse events could cause all sorts of weird side effects, like making VoiceOver unnecessarily read out some item's text, or whatever. You do not want to do this. Also, this way if you ever need to behave differently in the real mouse-over case than in the other, you can easily change one method that calls your selectItemAtPoint: method (or whatever you call it), while not changing the other. If you send a fake mouse event, you're discarding the information where this "mouse movement" came from.

Also, look into NSNotifications. You can use a notification to send out a general "progress finished" message and all views that need to know of it can then subscribe to that notification without the sender having to know about it. Of course, if you're dealing with views and a progress window, your views should probably just listen for window activation changes, or track mouse movements even while they're in the background (they wouldn't draw a highlight while they're in an inactive window, but that doesn't mean they can't update their internal "selected part" instance variable).

Cheers,
-- Uli Kusterer
"The witnesses of TeachText are everywhere..."



_______________________________________________

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


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

  • Prev by Date: priming the NSBeep pump?
  • Next by Date: Re: Bulletproof way to create a new CGBitmapContext from an existing image?
  • 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