WEB开发网
开发学院手机开发Symbian 开发 Symbian 常用对话框 阅读

Symbian 常用对话框

 2010-04-20 15:50:00 来源:WEB开发网   
核心提示:1、文本询问对话框资源的定义(注意分号)RESOURCE DIALOG r_text_query{flags = EGeneralQueryFlags;buttons = R_AVKON_SOFTKEYS_OK_CANCEL;items ={DLG_LINE{type = EAknCtQuery;id = EGener

1、文本询问对话框

资源的定义(注意分号)

RESOURCE DIALOG r_text_query

{

flags = EGeneralQueryFlags;

buttons = R_AVKON_SOFTKEYS_OK_CANCEL;

items =

{

DLG_LINE

{

type = EAknCtQuery;

id = EGeneralQuery;

control = AVKON_DATA_QUERY

{

layout = EDataLayout;

label = "";

control = EDWIN

{

width = 5;

lines = 1;

maxlength = 15;

};

};

}

};

}

调用该类的代码

TBuf<128> text; //保存用户输入信息

TBuf<128> prompt(_L("Enter text:")); //提示

CAknTextQueryDialog *dlg = new(ELeave)CAknTextQueryDialog(text, prompt);

dlg->SetMaxLength(20);

if (dlg->ExecuteLD(R_TEXT_QUERY))

{ //OK被按下

}

2、列表询问对话框

RESOURCE AVKON_LIST_QUERY r_demo_list_query

{

flags = EGeneralQueryFlags;

softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;

items =

{

AVKON_LIST_QUERY_DLG_LINE

{

control = AVKON_LIST_QUERY_CONTROL

{

listtype = EAknCtSinglePopupMenuListBox;

listbox = AVKON_LIST_QUERY_LIST

{

array_id = r_demo_list_query_item;

};

heading = "Select one item:";

};

}

};

}

RESOURCE ARRAY r_demo_list_query_item

{

items =

{

LBUF {txt = "First item"; },

LBUF {txt = "Second item"; },

LBUF {txt = "Third item"; }

};

}

调用的代码

TInt index( 0 );

CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &index );

if ( dlg->ExecuteLD(R_DEMO_LIST_QUERY) )

1 2  下一页

Tags:Symbian 常用 对话框

编辑录入:coldstar [复制链接] [打 印]
赞助商链接