Editing keyboard layouts
TStandardEditableVirtualKeyboard encapsulates a set of mapping rules for keys corresponding to the keys on standard physical keyboards (IBM and Macintosh). You can use this class to create a keyboard layout for use on any physical keyboard containing a subset of the virtual keys defined by the EVirtualKeyCode enum.
The simplest way to create a keyboard layout is to copy an existing layout and edit it. Adding a mapping rule to a virtual key and modifier combination replaces any previous rule for that combination.
To edit or create a virtual keyboard:
- Add individual mapping rules to a TStandardEditableVirtualKeyboard with the AddResult member function. To create a mapping rule for a particular key, supply the virtual key code, the required modifier keys, and the text result. You can express the text result as either a text instance or a single UniChar.
TStandardEditableVirtualKeyboard also provides some default relationships for modifier keys so that you do not need to create additional mapping rules for the Caps Lock and right modifier keys. You can specify parameters to override the behavior of these keys:
- Caps Lock modifier--by default, Caps Lock and Shift keys produce the same result for letters, but Caps Lock is ignored for numbers and punctuation. Specify the value ECapsLockRule::kAddSameRuleForCapsLock to override this behavior.
- Left and right modifier keys--by default the left and right versions of Shift, Option, Control, and Command produce identical results (if these keys exist). To override this behavior for a specific modifier key, specify the ERightLeftKeyRule::kDontAddSameRuleForRightKey value. You can then add another rule governing the right modifier key.
- Call the Compact member function. This function compresses the added rules for more efficient storage.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.
Generated with WebMaker