请问如何直接创建一个列表对话框,动态显示内容,请列出具体代码,越简单越好,谢谢!
------解决方案--------------------------------------------------------
void CDynamicSettingListAppView::LoadListL()
{
TBool isNumberedStyle = iItemList->IsNumberedStyle();
CArrayPtr<CGulIcon>* icons = iItemList->ListBox()->ItemDrawer()->FormattedCellData()->IconArray();
/*Text setting item*/
CAknTextSettingItem* item = new (ELeave) CAknTextSettingItem(1, iText);
CleanupStack::PushL(item);
item->SetEmptyItemTextL( KEmptyText );
// The same resource id can be used for multiple text setting pages.
item->ConstructL(isNumberedStyle, 1, KName, icons, R_TEXT_SETTING_PAGE, -1);
iItemList->SettingItemArray()->AppendL(item);
CleanupStack::Pop(item);
/*Integer setting item*/
CAknIntegerEdwinSettingItem* item2 = new (ELeave) CAknIntegerEdwinSettingItem(2, iNumber);
CleanupStack::PushL(item2);
// The same resource id can be used for multiple integer setting pages.
item2->ConstructL(isNumberedStyle, 2, KName2, icons, R_INTEGER_SETTING_PAGE, -1);
iItemList->SettingItemArray()->AppendL(item2);
CleanupStack::Pop(item2);
/*Password setting item*/
CAknPasswordSettingItem* item3 = new (ELeave) CAknPasswordSettingItem( 3,
CAknPasswordSettingItem::EAlpha,
iPassword);
CleanupStack::PushL(item3);
item3->SetEmptyItemTextL( KEmptyText );
// The same resource id can be used for multiple password setting pages.
item3->ConstructL(isNumberedStyle, 3, KName3, icons, R_PASSWORD_SETTING_PAGE, -1);
iItemList->SettingItemArray()->AppendL(item3);
CleanupStack::Pop(item3);
/*Volume setting item*/
CAknVolumeSettingItem* item4 = new (ELeave) CAknVolumeSettingItem(4, iVolume);
CleanupStack::PushL(item4);
// The same resource id can be used for multiple volume setting pages.
item4->ConstructL(isNumberedStyle, 4, KName4, icons, R_VOLUME_SETTING_PAGE, -1);
iItemList->SettingItemArray()->AppendL(item4);
CleanupStack::Pop(item4);
/*Slider setting item. Read release notes to know why CDynamicSettingListSlider is used
instead of CAknSliderSettingItem*/
CDynamicSettingListSlider* item5 = new (ELeave) CDynamicSettingListSlider(5, iSlider);
CleanupStack::PushL(item5);
// The same resource id can be used for multiple slider setting pages.
item5->ConstructL(isNumberedStyle, 5, KName5, icons, R_SLIDER_SETTING_PAGE, -1);
iItemList->SettingItemArray()->AppendL(item5);
CleanupStack::Pop(item5);
/*Date setting item*/
CAknTimeOrDateSettingItem* item6 = new (ELeave) CAknTimeOrDateSettingItem( 6,
CAknTimeOrDateSettingItem::EDate,
iDate);
CleanupStack::PushL(item6);
// The same resource id can be used for multiple date setting pages.
item6->ConstructL(isNumberedStyle, 6, KName6, icons, R_DATE_SETTING_PAGE, -1);
iItemList->SettingItemArray()->AppendL(item6);
CleanupStack::Pop(item6);
/*Time offset setting item*/
CAknTimeOffsetSettingItem* item7 = new (ELeave) CAknTimeOffsetSettingItem(7, iTime);
CleanupStack::PushL(item7);
// The same resource id can be used for multiple time offset setting pages.
item7->ConstructL(isNumberedStyle, 7, KName7, icons, R_TIMEOFFSET_SETTING_PAGE, -1);
iItemList->SettingItemArray()->AppendL(item7);
CleanupStack::Pop(item7);
/*Ip field setting item*/
CAknIpFieldSettingItem* item8 = new (ELeave) CAknIpFieldSettingItem(8, iIp);
CleanupStack::PushL(item8);
// The same resource id can be used for multiple ip field setting pages.
item8->ConstructL(isNumberedStyle, 8, KName8, icons, R_IPFIELD_SETTING_PAGE, -1);