Special handling of keystrokes in a window controller
Special handling of keystrokes in a window controller
- Subject: Special handling of keystrokes in a window controller
- From: Duncan Champney <email@hidden>
- Date: Wed, 23 Apr 2008 11:36:30 -0400
My app has a number of input fields that are used to change light
settings, camera x/y/z position, etc for a 3D view window. ALL these
fields are numeric, and don't need to handle non number characters
(they need to handle 0-9, "+", "-", ".", and possibly "E" for
scientific notation, although I'm not sure I need it.)
I have added the method control:textView:doCommandBySelector: to my
window controller, so I can intercept the up/down arrow keys when a
text field is the key field, and increment/decrement the field value.
My 3D view also has certain keystrokes that it handles. If the 3D view
is the current first responder, the user can click "+" / "-" (with or
without the shift key) to zoom in or out of the 3D view.
i would really like to have keystrokes that will zoom in or out of the
3D view regardless of what field on my window is the current first
responder. I couldn't use the plus or minus keys for this, because
some of my input values can be negative, and the user needs to be able
to type in a sign value in those fields.
Right now, if one of the input fields is the first responder, the plus
and minus keys go to that input field, changing the value of that
field. It's confusing for the user.
I could easily change my zoom in/zoom out keystrokes to be the bracket
keys ("[" "]" with or without shift), or some other set of keys that
are only used by the 3D view, but I need a way to intercept them. Is
there a clean way for me to catch certain keystrokes globally for the
window, and pass them to my 3D view, while letting others go to the
current firstResponder?
Duncan C
_______________________________________________
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