Question
I'm trying to display a standard list (not a Genlist) within a popup window in my Tizen native application. Despite trying various combinations, I can't get the list to display properly - only the popup title appears.
Here's my current implementation:
void create_popup(void *data, Evas_Object *obj, void *event_info) {
Evas_Object *list;
Evas_Object *parent = obj;
/* Create the popup */
Evas_Object *popup = elm_popup_add(parent);
elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_part_text_set(popup, "title,text", "Title");
elm_popup_orient_set(popup, ELM_POPUP_ORIENT_CENTER);
list = elm_list_add(popup);
elm_list_mode_set(list, ELM_LIST_COMPRESS);
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
char tmpString[16];
sprintf(tmpString, "Reset Game");
dlog_print(DLOG_INFO, APP_TAG, tmpString);
elm_list_item_append(list, tmpString, NULL, NULL, NULL, NULL);
elm_list_item_append(list, tmpString, NULL, NULL, NULL, NULL);
/* Register the Back key event callback */
eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
/* Show the popup */
elm_object_content_set(popup, list);
evas_object_show(popup);
}
I've tried several approaches without success:
- Adding a layout and placing the list within it
- Creating the list with the parent instead of the popup
- Removing all style settings
My goal is to create a menu when the menu button is pressed, similar to the example in the Tizen documentation.
Answer
Problem Understanding
The issue occurs when trying to display a standard list (elm_list) within a popup window. While the popup title appears correctly, the list items remain invisible. This is caused by incorrect list mode configuration.
Solution Methods
- The primary solution is to change the list mode from
ELM_LIST_COMPRESStoELM_LIST_EXPAND - Ensure proper size hints are set for both the popup and list
- Verify the list items are properly appended before setting the content
Code Examples
Here's the corrected implementation:
list = elm_list_add(popup);
/* Change this line from COMPRESS to EXPAND */
elm_list_mode_set(list, ELM_LIST_EXPAND);
evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL);
/* Add list items */
elm_list_item_append(list, "Reset Game", NULL, NULL, NULL, NULL);
elm_list_item_append(list, "Other Option", NULL, NULL, NULL, NULL);
/* Set list as popup content */
elm_object_content_set(popup, list);
Additional Tips
- Always check the EFL documentation for proper widget configuration
- When working with popups, ensure all child elements have proper size hints
- For more complex menu structures, consider using
Elm_Genlistinstead of basic lists - Test your UI on different device resolutions