Languages

Menu
Sites
Language
Layout only shows one componet

I am trying to add more components to the popup using a layout, I have this:

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);
    //eext_object_event_callback_add(ad->popup_setting, EEXT_CALLBACK_BACK, eext_popup_back_cb, NULL);
    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 *layout = elm_layout_add(ad->popup_setting);
    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(ad->popup_setting, layout);

    Evas_Object *button_popup_save = elm_button_add(ad->popup_setting);
    elm_object_text_set(button_popup_save, "Save");
    evas_object_smart_callback_add(button_popup_save, "clicked", setting_popup_save_cb, ad);
    elm_object_part_content_set(ad->popup_setting, "button1", button_popup_save);

    Evas_Object *button_popup_cancel = elm_button_add(ad->popup_setting);
    elm_object_text_set(button_popup_cancel, "Cancel");
    evas_object_smart_callback_add(button_popup_cancel, "clicked", setting_popup_cancel_cb, ad);
    elm_object_part_content_set(ad->popup_setting, "button2", button_popup_cancel);

    //elm_win_fullscreen_set (layout,true);

    Evas_Object *label = elm_label_add(layout);
    elm_object_text_set(label, LABELFORMATSTART "Waiting GPS status" LABELFORMATEND);
    elm_object_part_content_set(layout, "elm.swallow.content" , label);

    Evas_Object *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);

 

The two buttons appears because are out of the layout, but the layout only shows the text field compinent and not the label, and I can not underestand why...

Any idea?

Thanks

View Selected Answer

Responses

5 Replies
Mark Stoge

You have to fix your post. 

 

format the code as per forum rules (Press "<>" button and paste code in box).

 

 

Mark as answer
Shaswati Saha

You may try to do this using EDC programming. Here's my EDC file below. Create an edc file in the project res folder and modify that according to the following way.

collections {
   base_scale: 2.6;
   #define POPUP_CUSTOM_LABEL_LAYOUT_TEXT_FONT_SIZE_INC 0 38
   #define POPUP_CUSTOM_LABEL_VIEW_LAYOUT_PADDING_INC 15 27
   #define POPUP_TEXT_FONT_SIZE2 24
   #define POPUP_TEXT_FONT_SIZE1 30
   #define POPUP_CUSTOM_LABEL_TEXT_VIEW_LAYOUT_BG_MIN_INC 0 193
   group { name: "main";
      styles {
         style { name: "popup_processing_style";
         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE1" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
            tag:  "br" "\n";
            tag:  "tab" "\t";
         }
      }
      styles {
         style { name: "popup_subtext_style";
         base: "font=Tizen:style=Regular align=left font_size="POPUP_TEXT_FONT_SIZE2" color=#000000 wrap=mixed ellipsis=1.0 text_class=tizen";
            tag:  "br" "\n";
            tag:  "tab" "\t";
         }
      }
      parts {
         part { name: "bg";
            type: SPACER;
            scale: 1;
            description { state: "default" 0.0;
               min: POPUP_CUSTOM_LABEL_TEXT_VIEW_LAYOUT_BG_MIN_INC;
               fixed: 1 0;
            }
         }

         part { name: "pad_l_t";
            type: SPACER;
            scale: 1;
            description { state: "default" 0.0;
               min: POPUP_CUSTOM_LABEL_VIEW_LAYOUT_PADDING_INC;
               max: POPUP_CUSTOM_LABEL_VIEW_LAYOUT_PADDING_INC;
               fixed: 1 1;
               rel2.relative: 0.0 0.0;
               align: 0.0 0.0;
            }
         }
         part { name: "pad_r_t";
            type: SPACER;
            scale: 1;
            description { state: "default" 0.0;
               min: POPUP_CUSTOM_LABEL_VIEW_LAYOUT_PADDING_INC;
               max: POPUP_CUSTOM_LABEL_VIEW_LAYOUT_PADDING_INC;
               fixed: 1 1;
               rel1.relative: 1.0 1.0;
               align: 1.0 1.0;
            }
         }
         part { name: "elm.text.description";
            type: TEXTBLOCK;
            scale: 1;
            description { state: "default" 0.0;
               min: POPUP_CUSTOM_LABEL_LAYOUT_TEXT_FONT_SIZE_INC;
               fixed: 0 1;
               rel1 {
                  relative: 1.0 1.0;
                  to: "pad_l_t";
               }
               rel2 {
                  relative: 0.0 1.0;
                  to_x: "pad_r_t";
                  to_y: "pad_l_t";
               }
               text {
                  style: "popup_processing_style";
                  min: 0 1;
               }
               align: 0.0 0.0;
            }
         }

      }
   }
}


And use the edc code in the create_popup() function like below:

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


	Evas_Object *popup, *layout, *entry, *label, *btn, *btn1;
	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", "Title test");

	layout = elm_layout_add(popup);
	elm_layout_file_set(layout, ELM_DEMO_EDJ, "main");
	elm_object_part_text_set(layout, "elm.text.description", "Label Text");
	evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_object_content_set(popup, layout);


	evas_object_show(popup);

}

Note: Define the ELM_DEMO_EDJ as below in the project header file:

#define ELM_DEMO_EDJ "/opt/usr/apps/project_package_name/res/EDC_FILE_NAME.edj"

 

Carlos Dominguez

Thanks Saha!

Flavio Lima

Hi, i try use it in Gear S3 , but it doesn't work :( il send you a picture.

Flavio Lima

Already solve my issue.
https://developer.tizen.org/forums/native-application-development/custom-popup#comment-25490