I have a CAknSettingItemList-based listbox, and I need to add items to CAknEnumeratedTextPopupSettingItem field dynamically. If I define an empty array in the resource file, and then in PostLayoutDynInitL() dynamically add items to popup list, my program panics, because iSelectedItem becomes -1. I can't change its value, because it is private. But, if I edit aknsettingitemlist.h, make it public and set iSelectedItem manually to 0, it works fine. Is there any normal way to work it out? Why I am not allowed set its value? Or this class is only designed to be created from resources only?
I also tried to leave one item in the resource file and then delete it and add others dynamically, but this is a bad solution, because when first displayed the field keeps the old default active value (resource), but not added after construction.