How virtual keyboards are used

Typically, a virtual keyboard is used within a typing configuration. Each typing configuration identifies a single virtual keyboard and uses that keyboard to map keyboard input to text results.

The typing configuration accesses its virtual keyboard through an instance of TVirtualKeyboardHandle. It maps keyboard input to text using the handle's MapKeyToText member function. This function takes:

It uses the mapping rules of the current keyboard to determine the result. For example, this call maps the virtual S key and Shift key event into the appropriate text (TLatin::kCapitalLetterS for English keyboards), returning it in the text instance provided:

      TStandardText textResult;
      TModifierKeys modifiers;
      modifiers.SetShiftKey();
      keyboardHandle.MapKeyToText(TVirtualKeyCode::kC02, modifiers, textResult);
All the virtual keyboards installed on a system are managed by a keyboard server. The virtual keyboard classes reference the data by static pointers so that the virtual keyboard data does not have to be stored in each end user's address space.

You can get the handle of the current keyboard from the typing configuration using the TTypingConfigurationHandle::GetKeyboard member function. You can also use the TVirtualKeyboardHandle::SetCurrentKeyboard member function to access any available keyboard, using a localizable name to identify the keyboard you want. TVirtualKeyboard throws the TVirtualKeyboardException condition kKeyboardNotInstalled if you specify a nonexistent keyboard.



[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