Namespaces
Variants
Actions

Enumerated Text Popup Example

Jump to: navigation, search
Article Metadata

Code Example
Article
Created: Carbider (19 Nov 2007)
Last edited: hamishwillee (03 Jun 2013)



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.

Contrib 001 i01 enumerated properties.jpg

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 .

This page was last modified on 3 June 2013, at 10:54.
136 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved