我从诺基亚网站下了一个例子,按OK键打开POPUP列表时,如果列表里面的只有一个选项就没问题,如果多于一个就会报EXEC 3的错误,代码跟资源文件的定义都一摸一样,但是例子运行就正常,有没有人知道这个问题,急啊!
代码如下:
.cpp文件
void CSMSClientContainer2::LoadListL()
{
TBool isNumberedStyle = iItemList->IsNumberedStyle();
//CArrayPtr<CGulIcon>* icons = iItemList->ListBox()->ItemDrawer()->FormattedCellData()->IconArray();
/*Enumerated text setting item*/
CAknEnumeratedTextPopupSettingItem* item9 = new (ELeave) CAknEnumeratedTextPopupSettingItem(1, iEnumText);
CleanupStack::PushL(item9);
// The same resource id can be used for multiple enumerated text setting pages.
item9->ConstructL(isNumberedStyle, 1, KName9, NULL, R_SETTINGLIST_OPERATION_SETTING_PAGE, -1, 0, R_OPERATION_POPUP_SETTING_LIST);
// Load texts dynamically.
CArrayPtr<CAknEnumeratedText>* texts = item9->EnumeratedTextArray();
texts->ResetAndDestroy();
CAknEnumeratedText* enumText;
// Text 1
HBufC* text = KEnumText1().AllocLC();
enumText = new (ELeave) CAknEnumeratedText(0, text);
CleanupStack::Pop(text);
CleanupStack::PushL(enumText);
texts->AppendL(enumText);
CleanupStack::Pop(enumText);
//当把Text2屏蔽掉就没问题
// Text 2
text = KEnumText2().AllocLC();
enumText = new (ELeave) CAknEnumeratedText(1, text);
CleanupStack::Pop(text);
CleanupStack::PushL(enumText);
texts->AppendL(enumText);
CleanupStack::Pop(enumText);
iItemList->SettingItemArray()->AppendL(item9);
CleanupStack::Pop(item9);
// Required when there is only one setting item.
iItemList->SettingItemArray()->RecalculateVisibleIndicesL();
iItemList->HandleChangeInItemArrayOrVisibilityL();
}
资源文件:
RESOURCE AVKON_SETTING_ITEM_LIST r_main_setting_list {
title = "Setting";
}
RESOURCE AVKON_SETTING_PAGE r_settinglist_operation_setting_page {
type = EAknCtPopupSettingList;
editor_resource_id = r_settinglist_operation_popup_setting_list_new_entry;
}
RESOURCE POPUP_SETTING_LIST r_settinglist_operation_popup_setting_list_new_entry {
flags = 0;
}
RESOURCE AVKON_POPUP_SETTING_TEXTS r_operation_popup_setting_list {
setting_texts_resource = r_settinglist_operation_page_list;
}
RESOURCE ARRAY r_settinglist_operation_page_list {
items = {
AVKON_ENUMERATED_TEXT {value = 0;text = "dummy";}
};
}
------解决方案--------------------------------------------------------
一般是资源问题
确定重新abld build gcce/winscw udeb/urel
这个资源R_OPERATION_POPUP_SETTING_LIST是否重新生成,在.rsg文件里