Symbian 控件架构之对话框
2010-04-20 15:44:00 来源:WEB开发网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) )
{
// ok pressed, index is the selected item index.
}
程序中动态设置列表项例子
TInt index( 0 );
CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &index );
CDesCArrayFlat *aArray = new(ELeave)CDesCArrayFlat(3);
TBuf<16> aString;
aString.Format(_L("Item %d"), 1);
aArray->AppendL(aString);
更多精彩
赞助商链接