Control/Option keys both set "control" modifier flag in NSEvent
Control/Option keys both set "control" modifier flag in NSEvent
- Subject: Control/Option keys both set "control" modifier flag in NSEvent
- From: Dale Miller <email@hidden>
- Date: Sat, 6 Oct 2007 17:59:01 -0700
I have a test mini-application with an application controller
(subclass of NSApplication). It works as expected, except that in my
overridden "sendEvent"
method, i log the following:
a) the event (NSLog %@ format)
b) the result of a getKeys call- which is supposed to return a
bitmap of the depressed keys and can be called essentially at any time.
I have tried this with the left control, left option, right control,
and right option keys. To my surprise, the "NSFlagsChanged" envent
for the key press
returns the following:
a) left control down: keycode = 59 flags = 0004 (control key)
keymask = <0,8,0,0>
b)left option down keycode = 59 lfags = 0004 keymask = <0,8,0,0>
right option down keycode = 62 flags = 0004 keymask = <0,8,0,0>
right control down keycode = 62 flags = 0004 keymask = <0,8,0,0>
Any clues as to why this is happening?
I don't have an installable keymap or input server in use. The
HexInputServer sample code is installed,, but not selected.
I don't to my knowledge have any unique changes to the default key
bindings dictionnaries.
I have a need to capture a key press of a modifier key and treat it
as a normal key as long as no other key is pressed while it is down.
(please don't flame me about Apple HIG, etc -an emulator has gotta do
what it's gotta do). The logic to do this using the 'flags changed"
and "key down" events is not too difficult as long as I can determine
which modifier was pressed, but ...
I was hoping to avoid having to resort to installable keymaps or
input servers beause I have not been able to ferret out a way to
specify an application-specific keymap or input server
programmatically. Forcing the user to manually specify a keymap or
input server to make the application work seems
rather user-unfriendly.
Regards,
Dale Miller
email@hidden
_______________________________________________
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