Symbian 控件架构之对话框
2010-04-20 15:44:00 来源:WEB开发网Code:
control = EDWIN
{
flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
width = 11;
lines = 1;
maxlength = 11;
avkon_flags = EAknEditorFlagFixedCase |
EAknEditorFlagNoT9 | EAknEditorFlagSupressShiftMenu; //EAknEditorFlagSupressShiftMenu屏蔽切换输入法键
allowed_input_modes = EAknEditorNumericInputMode;
default_input_mode = EAknEditorNumericInputMode;
numeric_keymap = EAknEditorPlainNumberModeKeymap;
};
以上写法表示默认输入法为数字,并且屏蔽了输入法切换键,即不能通过输入法切换键来切换输入法。
6、编辑框
编辑框使用的类:
CEikGlobalTextEditor
头文件:eikgted.h
使用方法:
Code:
CEikGlobalTextEditor* iGKeyEd;
TBuf<128> iKeyText;
TResourceReader reader;
iCoeEnv->CreateResourceReaderLC( reader, R_RESOURCE_EDITOR ); //从资源文件构造编辑框,资源见下面的定义
iGKeyEd = new ( ELeave ) CEikGlobalTextEditor;
iGKeyEd->SetContainerWindowL( *this );
iGKeyEd->ConstructFromResourceL( reader );
CleanupStack::PopAndDestroy(); // Resource reader
//设置编辑框的初始文本和位置,编辑框大小在资源中定义
TBuf<32> buf;
buf.Copy(_L("demo"));
iGKeyEd->SetTextL(&buf);
iGKeyEd->SetExtent( TPoint(5,2), iGKeyEd->MinimumSize() );
iGKeyEd->SetFocus(ETrue);
// iGKeyEd->SetReadOnly(ETrue); //设置编辑框为只读
//使文字居中
CParaFormat paraFormat;
TParaFormatMask paraFormatMask;
paraFormatMask.SetAttrib( EAttAlignment ); // set mask
paraFormat.iHorizontalAlignment = CParaFormat::ECenterAlign;
iGKeyEd->ApplyParaFormatL( ¶Format, paraFormatMask );
iGKeyEd->GetText(iKeyText); //获取编辑框中的内容,保存到iKeyText中
更多精彩
赞助商链接