How to check the current input method type of the edit box in Symbian

Source: Internet
Author: User
During full screen program development, the current input method in the editing box needs to be determined in time to facilitate texture presentation on the interface. The following three steps can be used to complete this function:

1. Add the relevant header file to the. h file.
# Include <eikenv. h> // For caknenv: static ()
# Include <aknindicatorcontainer. h> // For caknindicatorcontainer

2. Add the class definition used in the. h file.
Struct s_uid: Public tuid
{
S_uid (int I)
{
Iuid = I;
}
};

Class makneditingstateindicator
{
Public:
Virtual void setstate (takneditingstate astate) = 0;
Virtual caknindicatorcontainer * indicatorcontainer () = 0;
};

In the system header file (C:/Symbian/7.0 S/series60_v20/epoc32/include/aknenv. h) the class caknenv uses the class makneditingstateindicator, but this class definition is not provided in the SDK. Therefore, you must add it here.

3. Implemented in the. cpp File

Void testinputmethod ()
{
Makneditingstateindicator * Ei = caknenv: static ()-> editingstateindicator ();
If (! EI) return;

Caknindicatorcontainer * Ic = EI-> indicatorcontainer ();
If (! Ic) return;

If (IC-> indicatorstate (s_uid (eaknnavipaneeditorindicatort9 )))
{
// To do... if input method = T9 (pinyin and strokes)
}
Else if (IC-> indicatorstate (s_uid (eaknnavipaneeditorindicatorlowercase )))
{
// To do... if input method = "ABC ";
}
Else if (IC-> indicatorstate (s_uid (eaknnavipaneeditorindicatoruppercase )))
{
// To do... if input method = "ABC ";
}
Else if (IC-> indicatorstate (s_uid (eaknnavipaneeditorindicatortextcase )))
{
// To do... if input method = "ABC ";
}
Else if (IC-> indicatorstate (s_uid (eaknnavipaneeditorindicatornumbercase )))
{
// To do... if input method = "123 ";
}
}
In this way, when the current input method is pinyin or strokes, the indicatorstate (s_uid (eaknnavipaneeditorindicatort9) is true because the input method is switched in a certain order, therefore, we can consider using order to further judge the two input methods.

In the SDK directory c:/Symbian/7.0 S/series60_v20/epoc32/include/avkon. HRH (or C:/Symbian/8.0a/s60_2nd_fp2_ SC/epoc32/include/avkon. HRH) to define the enumerated values used above.
// Navi pane editor indicators
Eaknnavipaneeditorindicatort9 = 100,
Eaknnavipaneeditorindicatoruppercase,
Eaknnavipaneeditorindicatorlowercase,
Eaknnavipaneeditorindicatortextcase,
Eaknnavipaneeditorindicatornumbercase,
Eaknnavipaneeditorindicatorquery,
Eaknnavipaneeditorindicatorqwertyshift,

Eaknnavipaneeditorindicatorarabiccase = 130,
Eaknnavipaneeditorindicatorhebrewcase,
Eaknnavipaneeditorindicatorarabicindicnumbercase,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.