Re: How to imitiate mouse move programmatically? [NSApp postEvent:atStart:] does not work...
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