Re: How can text field validation be triggered?
Re: How can text field validation be triggered?
- Subject: Re: How can text field validation be triggered?
- From: Bill Cheeseman <email@hidden>
- Date: Wed, 19 Nov 2003 06:04:06 -0500
on 2003-11-18 2:09 PM, Dave MacLachlan at email@hidden wrote:
>
Is there a way to determine what the virtual key code is for a given
>
keyboard yet? I'm looking for virtual keycods for cmd, opt, shift,
>
tab,F1-F16 etc.
You're using Cocoa? NSEvent and NSText declare constants for every function
key and navigation key on any keyboard (all the way up to F35 in the case of
top-row function keys). You test [[[NSApp currentEvent] characters]
objectAtIndex:0] against those constants to determine which key was pressed,
if it isn't a printable character key. You use NSEvent's keyCode method to
get the key code. You don't have to know what kind of keyboard is attached
to the user's computer, because this is all hardware independent to you.
You can see this in action by downloading the 30-day trial version of my
PreFab UI Browser application at <http:www.prefab.com/uibrowser/>. In the
Keystrokes drawer, press any key, and you will see its Unicode glyph and its
key code.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
accessibility-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/accessibility-dev
Do not post admin requests to the list. They will be ignored.