一切尽在源码中。想当年有多少symbian程序员浪费无数的时间去猜测这些恶心的实现!!!!
EXPORT_C void CEikSecretEditor::ConstructFromResourceL(TResourceReader& aReader) // // Construct from resource // { iMaxLen=aReader.ReadUint16(); __ASSERT_ALWAYS(iMaxLen<=EMaxSecEdSecArrayLength, Panic(EEikPanicSecretEditorTooLong)); iSecCharArr = HBufC::NewL( EMaxSecEdSecArrayLength ); iFepState = CreateFepStateL();//设置输入法 if ( !iExtension ) { iExtension = CEikSecretEditorExtension::NewL(); } InitCRedirectionListenerL(); }
EXPORT_C MCoeFepAwareTextEditor_Extension1::CState* CEikSecretEditor::CreateFepStateL() { CAknEdwinState* editorState = new(ELeave) CAknEdwinState(); // The status of AknLayoutUtils::Variant() is no longer checked -> Both // European and APAC variants enable EAknEditorFlagLatinInputModesOnly. editorState->SetFlags( EAknEditorFlagNoLRNavigation | EAknEditorFlagLatinInputModesOnly | EAknEditorFlagNoT9 | EAknEditorFlagUseSCTNumericCharmap ); editorState->SetDefaultInputMode(EAknEditorSecretAlphaInputMode);//默认只能是字母输入法 editorState->SetCurrentInputMode(EAknEditorSecretAlphaInputMode); editorState->SetPermittedCases(EAknEditorLowerCase|EAknEditorUpperCase); editorState->SetCurrentCase(EAknEditorLowerCase); editorState->SetPermittedInputModes(EAknEditorSecretAlphaInputMode | EAknEditorNumericInputMode);//也可以是数字输入法 editorState->SetDefaultCase(EAknEditorLowerCase); editorState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG_LATIN_ONLY); editorState->SetNumericKeymap(EAknEditorPlainNumberModeKeymap); editorState->SetObjectProvider(this); return editorState; }
iSecret1->ConstructFromResourceL( reader ); 之后加上 iSecret1->SetDefaultInputMode(EAknEditorNumericInputMode | EAknEditorSecretAlphaInputMode);//两种输入法都支持了
ps:但是在模拟器(s60 3rd mr)上还只显示字母,不过装到手机上是可以切到数字输入法的.不知道是我的问题还是模拟器的问题?