Re: Keyboard/Mouse Event Interaction
Re: Keyboard/Mouse Event Interaction
- Subject: Re: Keyboard/Mouse Event Interaction
- From: Alastair Houghton <email@hidden>
- Date: Sun, 17 Jul 2016 21:03:21 +0100
On 17 Jul 2016, at 14:06, Dave <email@hidden> wrote:
>
> My question is, do the keyboard and Mouse Down Events come in pairs, so that the following would/should not occur:
No. KeyDown happens when the key goes down, KeyUp happens when they key comes back up. Likewise with MouseDown and MouseUp, and they can happen in any order relative to one another (or relative to another KeyDown/Up or MouseDown/Up).
> Thanks a lot for any info on this. From looking at it, I think that the MouseDown/Up and KeyboardDown/Up must come if pairs with no events to the other device(s) in between, but it would be nice to know for sure!
The reason you see this kind of behaviour sometimes is that *some* views process events in a loop in their -mouseDown: handler. See this blog post I wrote in 2007 about event handling, which shows two different ways of handling -mouseDown: and talks a bit about eating keypresses during processing.
https://alastairs-place.net/blog/2007/11/19/commands-and-mo/
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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