Languages

Menu
Sites
Language
Put labels and input text field in a popup

Hi to all!

I want to put some labels and input fields in a popup element, as a configuration window. I have this code:

void create_popup_setting(void *data){
    appdata_s *ad = data;

    ad->popup_setting = elm_layout_add(ad->conform);
    elm_popup_align_set(ad->popup_setting, ELM_NOTIFY_ALIGN_FILL, 1.0);
    evas_object_size_hint_weight_set(ad->popup_setting, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_object_text_set(ad->popup_setting, "Settings");

    Evas_Object *conform = elm_conformant_add(ad->popup_setting);
    Evas_Object *table = elm_table_add(ad->popup_setting);
    //elm_table_padding_set(table, 100, 0);

    elm_object_content_set(conform, table);
    evas_object_show(table);

    my_table_pack(table, NULL, 0, 0, 4, 10);

    Evas_Object *button_save_popup;
    button_save_popup = elm_button_add(conform);
    elm_object_text_set(button_save_popup, "Save");
    evas_object_smart_callback_add(button_save_popup, "clicked", setting_popup_save_cb, ad);
    //elm_object_part_content_set(ad->popup_setting, "button1", button_save_popup);
    evas_object_size_hint_weight_set(button_save_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(button_save_popup, EVAS_HINT_FILL, 0.5);
    elm_table_pack(table, button_save_popup,0,9,2,1);
    evas_object_show(button_save_popup);

    evas_object_show(ad->popup_setting);
}

 

 

 

I tryed also:

 

void create_popup_setting(void *data){
    appdata_s *ad = data;

    ad->popup_setting = elm_popup_add(ad->conform);
    elm_popup_align_set(ad->popup_setting, ELM_NOTIFY_ALIGN_FILL, 1.0);
    evas_object_size_hint_weight_set(ad->popup_setting, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_object_text_set(ad->popup_setting, "Settings");

    Evas_Object *conform = elm_conformant_add(ad->popup_setting);
    Evas_Object *table = elm_table_add(ad->popup_setting);
    //elm_table_padding_set(table, 100, 0);

    elm_object_content_set(conform, table);
    evas_object_show(table);

    my_table_pack(table, NULL, 0, 0, 4, 10);

    Evas_Object *button_save_popup;
    button_save_popup = elm_button_add(conform);
    elm_object_text_set(button_save_popup, "Save");
    evas_object_smart_callback_add(button_save_popup, "clicked", setting_popup_save_cb, ad);
    //elm_object_part_content_set(ad->popup_setting, "button1", button_save_popup);
    evas_object_size_hint_weight_set(button_save_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    evas_object_size_hint_align_set(button_save_popup, EVAS_HINT_FILL, 0.5);
    elm_table_pack(table, button_save_popup,0,9,2,1);
    evas_object_show(button_save_popup);

    Evas_Object *button_cancel_popup;
    button_cancel_popup = elm_button_add(conform);
    elm_object_text_set(button_cancel_popup, "Cancel");
    evas_object_smart_callback_add(button_cancel_popup, "clicked", setting_popup_exit_cb, ad);
    elm_object_part_content_set(ad->popup_setting, "button2", button_cancel_popup);
}

 

But is not showing nothing.

Any suggestion?

Thanks to all!

View Selected Answer

Responses

2 Replies
Mark as answer
Shaswati Saha

Please try using the code below. To keep it simple, I've tried to do this with a label and a entry object.
 

void create_popup(void *data)
{
        appdata_s *ad = data;
	Evas_Object *popup, *layout, *entry;
	popup = elm_popup_add(ad->conform);
	elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0);
	eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
	evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_object_part_text_set(popup, "title,text", "Titletest");

	layout = elm_layout_add(popup);
	elm_layout_theme_set(layout, "layout", "drawer", "panel");
	evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_object_content_set(popup, layout);

	entry = elm_entry_add(layout);
	elm_entry_single_line_set(entry, EINA_TRUE);
	elm_entry_scrollable_set(entry, EINA_TRUE);
	evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
	eext_entry_selection_back_event_allow_set(entry, EINA_TRUE);
	elm_object_part_text_set(entry, "elm.guide", "Guide Text");
	elm_object_part_content_set(layout, "elm.swallow.content" , entry);

	evas_object_show(popup);

}

 

Carlos Dominguez

Thanks another time Saha!