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,
Eaknnavipaneeditorindicatorpinyin // pinyin
Eaknnavipaneeditorindicatorstroke // stroke