Re: Getting the current state of the modifier keys
Re: Getting the current state of the modifier keys
- Subject: Re: Getting the current state of the modifier keys
- From: matt neuburg <email@hidden>
- Date: Sat, 22 Feb 2003 20:59:44 -0800
On Sat, 22 Feb 2003 15:07:50 -0600, Jeffrey Mattox <email@hidden> said:
>
I have a Cocoa routine that gets a single keystroke or mouse click
>
event. If a modifier key is down, I want to wait until the modifier
>
key is released before proceeding. My routine only gets the one
>
event, not any others. Is there a way to test the current state of
>
the modifiers without getting another event?
>
>
I know how to test the event to see if a modifier key was on, but I
>
need to wait for the key(s) to be released.
I'm not understanding the phrase "my routine only gets the one event, not any others". It sounds like you're fighting the AppKit. Let the AppKit do the work. If a modifier key is down, then when it goes up you'll get a flagsChanged event and you can do whatever you're supposed to do. Just maintain state in the meantime in an ivar.
If you really want to you can make a small event loop inside the current routine, as described in the docs (HandlingMouseEvents.html). Or you can poll the keyboard in a loop (yecch!) using Carbon. But it's hard for me to believe you need to resort to either of those. m.
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.