symbian对话框汇总2

询问对话框
继承自CAknQueryDialog,询问对话框有两种:Local和Global。Local只在该应用内可显示;全局

的在任何时候都会显示,包括将该应用切换到后台。

本地询问对话框
分为三类:1. 确认对话框 2. 数据请求对话框 3. 列表请求对话框 4. 多选列表请求框
1. 确认对话框

RESOURCE DIALOG r_aknexquery_confirmation_query
{
        flags = EGeneralQueryFlags;
        buttons = R_AVKON_SOFTKEYS_YES_NO;
        items =
        {
                DLG_LINE
                {
                        type = EAknCtQuery;
                        id = EGeneralQuery;
                        control = AVKON_CONFIRMATION_QUERY
                        {
                                layout = EConfirmationQueryLayout;
                                label = qtn_aknexquery_con_label_text;
                                bmpfile = AKNEXQUERY_BMPFILE_NAME;
                                bmpid = EMbmAknexqueryLshellicon;
                                bmpmask = AKNEXQUERY_BITMAP_MASK_FLAG;
                        };
                }
        };
}

TBuf<256> msg(_L("Delete note?"));
CAknQueryDialog* dlg = CAknQueryDialog::NewL( );
if ( dlg->ExecuteLD(R_AKNEXQUERY_CONFIRMATION_QUERY, msg))
{
        // yes/ok pressed
}

2. 数据请求对话框
文本请求对话框
RESOURCE DIALOG r_demo_data_query
{
        flags = EGeneralQueryFlags;
        buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
        items =
        {
                DLG_LINE
                {
                        type = EAknCtQuery;
                        id = EGeneralQuery;
                        control = AVKON_DATA_QUERY
                        {
                                layout = EDataLayout;
                                label = ""; // prompt text
                                control = EDWIN
                                {
                                        width = 5;
                                        lines = 1;
                                        maxlength = 15;
                                };
                        };
                }
        };
}

AVKON_DATA_QUERY资源包含了layout,label和请求对话框中控件。layout和空间的映射关系

如下:

文本请求对话框对应的类是:CAknTextQueryDialog。下面代码示例之:
// The descriptor used for the editor
TBuf<128> text;

// The descriptor contained the prompt text for the query. The prompt // text can also be defined in the

resource structure of the query
TBuf<128> prompt(_L("Enter data:"));

// create dialog instance
CAknTextQueryDialog* dlg = new( ELeave ) CAknTextQueryDialog( text, prompt );

// Prepares the dialog, constructing it from the specified resource
dlg->PrepareLC( R_DEMO_DATA_QUERY );

// Sets the maximum length of the text editor
dlg->SetMaxLength(10);

// Launch the dialog
if (dlg->RunLD())
{
        // ok pressed, text is the descriptor containing the entered text // in the editor.
}

数字请求对话框

 

RESOURCE DIALOG r_aknexquery_number_layout
{
        flags = EGeneralQueryFlags;
        buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
        items =
        {
                DLG_LINE
                {
                        type = EAknCtQuery;
                        id = EGeneralQuery;
                        control= AVKON_DATA_QUERY
                        {
                                layout = ENumberLayout;
                                label = qtn_aknexquery_num_label_text;
                                control = AVKON_INTEGER_EDWIN
                                {
                                        min = AKNEXQUERY_NUMBER_EDITOR_MIN;
                                        max = AKNEXQUERY_NUMBER_EDITOR_MAX;
                                };
                        };
                }
        };
}

数字请求对话框对应的类是:CAknNumberQueryDialog。下面代码示例之:
#include <aknQueryDialog.h> // all the query dialog listed here

TInt number(123456);
// create dialog instance; number is the descriptor that is used for // the editor
CAknNumberQueryDialog* dlg = new (ELeave) CAknNumberQueryDialog (number);

// Prepares the dialog, constructing it from the specified resource
dlg->PrepareLC(R_AKNEXQUERY_NUMBER_LAYOUT);

// Set maximum and minimum to editor. This overrides values given in // resource. - optional
dlg->SetMinimumAndMaximum( 0, 1000000 );

// Launch the dialog
if (dlg->RunLD())
{
        // ok pressed, number is the entered number in the editor.
}

时间/日期请求对话框

RESOURCE DIALOG r_aknexquery_time_query
{
        flags = EGeneralQueryFlags;
        buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
        items =
        {
                DLG_LINE
                {
                        type = EAknCtQuery;
                        id = EGeneralQuery;
                        control = AVKON_DATA_QUERY
                        {
                                layout = ETimeLayout;
                                label = qtn_aknexquery_time_label_text;
                                control = TIME_EDITOR
                                {
                                        minTime = TIME
                                        {
                                                second =AKNEXQUERY_TIME_EDITOR_MIN_SECOND;
                                                minute =AKNEXQUERY_TIME_EDITOR_MIN_MINUTE;
                                                hour =AKNEXQUERY_TIME_EDITOR_MIN_HOUR;
                                        };
                                        maxTime = TIME
                                        {
                                                second =AKNEXQUERY_TIME_EDITOR_MAX_SECOND;
                                                minute =AKNEXQUERY_TIME_EDITOR_MAX_MINUTE;
                                                hour =AKNEXQUERY_TIME_EDITOR_MAX_HOUR;
                                        };
                                        flags = EEikTimeWithoutSecondsField;
                                };
                        };
                }
        };
}

时间/日期请求对话框对应的类是:CAknTimeQueryDialog。下面代码示例之:
TTime time(_L("20000111:200600.000000"));

// The prompt text for the query
TBuf<128> prompt(_L("Enter Time:"));

// create dialog instance; time is a reference to TTime object that is // used for the editor
CAknTimeQueryDialog* dlg =CAknTimeQueryDialog::NewL( time, CAknQueryDialog::ENoTone);
CleanupStack::PushL(dlg);

// set prompt text for query. This will override text given in resource
dlg->SetPromptL(prompt);
CleanupStack::Pop(); //dlg

// launch the dialog with resource
if (dlg->ExecuteLD(R_AKNEXQUERY_TIME_QUERY))
{
        // ok pressed, time is a Ttime object containing the entered time // in the editor.
}

持续时间请求对话框

 

持续时间请求对话框跟时间/日期请求对话框类似,区别是它的layout是EDurationLayout,control是DURATION_EDITOR

RESOURCE DIALOG r_aknexquery_duration_layout
{
        flags = EGeneralQueryFlags;
        buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
        items =
        {
                DLG_LINE
                {
                        type = EAknCtQuery;
                        id = EGeneralQuery;
                        control = AVKON_DATA_QUERY
                        {
                                layout = EDurationLayout;
                                label = qtn_aknexquery_dura_label_text;
                                control = DURATION_EDITOR
                                {
                                        minDuration = DURATION
                                        {
                                        };
                                        maxDuration = DURATION
                                        {
                                                seconds = AKNEXQUERY_DURATION_EDITOR_MAX_SECOND;
                                        };
                                        flags = AKNEXQUERY_DURATION_EDITOR_FLAGS;
                                };
                        };
                }
        };
}

其中:

STRUCT DURATION_EDITOR
{
        STRUCT minDuration; // DURATION
        STRUCT maxDuration; // DURATION
        BYTE flags=0; // permitted flags:
        // EEikTimeWithout[Seconds][Hours]Field
}
STRUCT DURATION
{
        LONG seconds=0; // must be greater than or equal to zero
}

持续时间请求对话框对应的类是:CAknDurationQueryDialog。下面代码示例之:
TTimeIntervalSeconds duration;

// create dialog instance; duration is a reference to
// TTimeIntervalSeconds object that is used for the editor
CAknDurationQueryDialog* dlg = CAknDurationQueryDialog::NewL(duration, CAknQueryDialog::ENoTone );

// launch the dialog with resource
if (dlg->ExecuteLD(R_AKNEXQUERY_DURATION_LAYOUT))
{
        // ok pressed, duration is a TtimeIntervalSeconds object
        // containing the entered duration in the editor.
}

浮点数请求对话框

RESOURCE DIALOG r_demo_floating_query
{
        flags = EGeneralQueryFlags;
        buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
        items =
        {
                DLG_LINE
                {
                        type = EAknCtQuery;
                        id = EGeneralQuery;
                        control = AVKON_DATA_QUERY
                        {
                                layout = EFloatingPointLayout;
                                label = "Enter value :";
                                control = FLPTED
                                {
                                        maxlength=10;
                                        min=0;
                                        max=100;
                                        default=0;
                                };
                        };
                }
        };
}

STRUCT FLPTED
{
        WORD maxlength=18;
        DOUBLE min=-9.9e99;
        DOUBLE max=9.9e99;
        DOUBLE default=0; // if !(min<=default<=max), default = min.
}

浮点数请求对话框对应的类是:CAknFloatingPointQueryDialog。下面代码示例之:

TReal value = 2.12345;
// create dialog instance; value is a TReal reference that is used for // the editor
CAknFloatingPointQueryDialog* dlg =new (ELeave) CAknFloatingPointQueryDialog (value);

// launch the dialog with resource R_DEMO_FLOATING_QUERY
if (dlg->ExecuteLD( R_DEMO_FLOATING_QUERY ))
{
        // ok pressed, value is the entered floating point number in the // editor.
}

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值