Symbian 控件架构之对话框
2010-04-20 15:44:00 来源:WEB开发网RESOURCE GTXTED R_RESOURCE_EDITOR //编辑框资源
{
flags = EAknEditorFlagDefault;
width = 53;
height = 16;
numlines = 1;
textlimit= 1;
fontcontrolflags = EGulFontControlAll;
fontnameflags = EGulNoSymbolFonts;
//这里也可设置输入法
// avkon_flags = EAknEditorFlagFixedCase |
EAknEditorFlagNoT9 | EAknEditorFlagSupressShiftMenu; //EAknEditorFlagSupressShiftMenu
屏蔽切换输入法键
// allowed_input_modes = EAknEditorNumericInputMode;
// default_input_mode = EAknEditorNumericInputMode;
// numeric_keymap = EAknEditorPlainNumberModeKeymap;
}
注意,要使编辑框正常显示,记得更改container的CountComponentControls和ComponentControl函数,正确处理控件数目和编辑框指针。另外,要使编辑框能正常接收按键事件,要显示调用编辑框的OfferKeyEventL函数,如下:
Code:
TKeyResponse CMobileGuardSetKeyContainer::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
{
return iGKeyEd->OfferKeyEventL( aKeyEvent, aType );
}
标准对话框
Symbian OS中的对话框都从CAknDialog中继承,大多数对话框是一个容器,可以容纳其他控件。下面示例如何在资源文件中定义一个带有编辑框的对话框:
RESOURCE DIALOG r_dialog_edit_dialog
{
flags = EEikDialogFlagNoDrag | EEikDialogFlagCbaButtons | EEikDialogFlagWait;
buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
items = {
DLG_LINE
{
id = EConfirmationNoteDlgCIdFileName;
type = EEikCtLabel;
control = LABEL { };
},
DLG_LINE
{
id = EConfirmationNoteDlgCIdEditor;
type = EEikCtEdwin;
control = EDWIN { maxlength = 20; };
}
};
}
DIALOG有以下几个属性需要设置:
更多精彩
赞助商链接