Enumerated Text Popup Example
Article Metadata
Code Example
Article
Contents |
1. Introduction to the example
This example shows how to instantiate "Enumerated Text Popup" control using Carbide C++ UI Designer. After adding "Enumerated Text Popup" to the setting list the compiler reported: "The list of popup items in 'enumeratedTextPopup1' is empty; this will cause a panic at runtime."
In some reason there was no way to add items into this control using it's properties.
To do that it is necessary to define them in resource file manually.
2. Create project.
With Carbide C++ IDE select:
"File"->"New"->"Symbian OS C++ Project"->"3rd Ed GUI with UI Designer"
Then give the name to your project as: "EnumeratedTextEx"
and select "Setting Item List" UI Design template.
3. Insert Enumerated Text Popup control
To insert Enumerated Text into design, at "Palette->Controls" tab pick "Enumerated Text Popup Setting Item" and drop it to Design.
4. Redefine and expand resource file
There are two attributes that should be redefined. They are:
r_enumerated_text_ex_setting_item_list_enumerated_text_popup1_setting_texts_resource
r_enumerated_text_ex_setting_item_list_enumerated_text_popup1_popped_up_texts_resource
at following resource file:
<project_path>/data/EnumeratedTextExSettingItemList.rssi
Defenition of items that show current Enumerted Text's state:
RESOURCE ARRAY r_enumerated_text_ex_setting_item_list_enumerated_text_popup1_setting_texts_resource
{
items =
{
AVKON_ENUMERATED_TEXT
{
value = 0;
text = "item_0";
},
AVKON_ENUMERATED_TEXT
{
value = 1;
text = "item_1";
},
AVKON_ENUMERATED_TEXT
{
value = 2;
text = "item_2";
},
AVKON_ENUMERATED_TEXT
{
value = 3;
text = "item_3";
},
AVKON_ENUMERATED_TEXT
{
value = 4;
text = "item_4";
},
AVKON_ENUMERATED_TEXT
{
value = 5;
text = "item_5";
},
AVKON_ENUMERATED_TEXT
{
value = 6;
text = "item_6";
},
AVKON_ENUMERATED_TEXT
{
value = 7;
text = "item_7";
},
AVKON_ENUMERATED_TEXT
{
value = 8;
text = "item_8";
}
};
}
Defenition of items that will be shown during user choice process:
RESOURCE ARRAY r_enumerated_text_ex_setting_item_list_enumerated_text_popup1_popped_up_texts_resource
{
items =
{
LBUF
{
txt = "choose_0";
},
LBUF
{
txt = "choose_1";
},
LBUF
{
txt = "choose_2";
},
LBUF
{
txt = "choose_3";
},
LBUF
{
txt = "choose_4";
},
LBUF
{
txt = "choose_5";
},
LBUF
{
txt = "choose_6";
},
LBUF
{
txt = "choose_7";
},
LBUF
{
txt = "choose_8";
}
};
}
5. Code implementation
There is a need to insert a line to ConstructL() method:
void TEnumeratedTextExSettingItemListSettings::ConstructL()
{
SetEnumeratedTextPopup1( NULL );
}
at file:
"<uidesign-name>.cpp"
6. Source code
The considered example can be downloaded as a Carbide C++ project here: File:EnumeratedTextEx.zip
To know how import sources to Carbide look here .



18 Sep
2009
This article represents how to instantiate "Enumerated Text Popup" control using Carbide C++ UI designer. There are some situations, where we can not add add items to the Enumerated text popup control and it may panic. The solution is to define them in resource file manually.
The article well-explains all related concepts in detail with code snipest. The article demostrates a good example for that. Also provides source code for the example for our reference.
The article is specially meant for intermediate developers.