This page was last modified 10:40, 24 August 2007.
TSS000415 - Mapping of physical keys across language variants
From Forum Nokia Wiki
Subject:
| Mapping of physical keys across language variants
| TSS000415
|
| Platform(s):
| Device(s), SW version(s):
|
| S60 3rd Edition, S60 3rd Edition FP1
|
|
Category:
| Symbian C++
|
Subcategory:
| UI Localization
|
Description:
| Overview: It is a common requirement for applications to be independent of language variants. This requires mapping of physical keys to logical keys. The mapping is language dependent. Note that all FEP-aware controls, such as standard S60 UI (Avkon) editors, take care of this mapping automatically. However, if the application needs to accept text input by handling individual key events, key mapping for different language variants may cause problems, especially in S60 devices that feature a QWERTY keyboard (Nokia E61, Nokia E70). Solution: CPtiEngine class can be used for resolving the correct mapping for each key. Required header files, PtiEngine.h and PtiKeyMappings.h, are available in the SDK from S60 3rd Edition onwards. Important classes in this API are CPtiEngine, CPtiCoreLanguage, TPtiKey, and CPtiQwertyKeyMappings. Below is a simplified example for getting the key mapping for a particular scan code: CPtiEngine *iEngine; CPtiCoreLanguage* iCoreLanguage; CPtiKeyMappings* iPtiKeyMappings; CPtiQwertyKeyMappings* iQwertyKeyMappings; TBuf<50> iResult; ... // Get the current language TLanguage lang = User::Language(); // scan code of the key you are interested in TPtiKey key = (TPtiKey)aScanCode; TPtiTextCase case = EPtiCaseLower; // Instantiate the engine iEngine = CPtiEngine::NewL(ETrue); // Make a language object based on current language iCoreLanguage = static_cast<CPtiCoreLanguage*>( iEngine->GetLanguage(lang)); // Get the keyboard mappings for the language iQwertyKeyMappings = static_cast<CPtiQwertyKeyMappings*>( iCoreLanguage->GetQwertyKeymappings()); // Finally, get mapping for a particular key. iQwertyKeyMappings->GetDataForKey( key, iResult, case); // iResult now contains the correct mapping // for the key
|
Creation date:
| September 21, 2006
|
Last modified:
| -
|