Symbian 常用 Dialog
2010-02-09 03:55:00 来源:WEB开发网{
layout = EConfirmationQueryLayout;
label = "对话框中显示的文字";
};
}
};
}
此类对话框可以有声音提示,由NewL的const TTone& aTone参数指定,可能的值如下:
Code:
enum TTone {
/// No tone is played
ENoTone = 0,
/// A confirmation tone is played
EConfirmationTone = EAvkonSIDConfirmationTone,
/// A warning tone is played
EWarningTone = EAvkonSIDWarningTone,
/// An error tone is played
EErrorTone = EAvkonSIDErrorTone
};
通过定义不同的询问对话框资源,可实现不同的询问对话框,如让用户输入文字的询问对话框资源定义如下:
Code:
RESOURCE DIALOG R_RESOURCE_DATA_QUERY
{
flags = EGeneralQueryFlags;
buttons = R_AVKON_SOFTKEYS_OK_CANCEL; //CBA按钮显示“确定”和“取消”
items =
{
DLG_LINE
{
type = EAknCtQuery;
id = EGeneralQuery;
control = AVKON_DATA_QUERY //表示这是data询问对话框,需要用户输入内容
{
layout = EDataLayout;
label = "提示内容";
control = EDWIN
{
flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
width = 30;
lines = 2;
maxlength = 159;
};
};
}
};
}
使用方法:
Code:
TBuf<128> msg;
CAknTextQueryDialog* dlg = new (ELeave) CAknTextQueryDialog(msg,CAknQueryDialog::ENoTone);
TInt ret = dlg->ExecuteLD(R_RESOURCE_DATA_QUERY);
用户输入内容后按“确定”,内容就存储到msg中,函数返回非0;按“取消”,函数返回0。
这里用到的类是CAknQueryDialog的子类CAknTextQueryDialog。
CAknQueryDialog的子类有:
Code:
CAknFloatingPointQueryDialog //This class should be used when user is
更多精彩
赞助商链接