how make padding between the box and its children

how make padding between the box and its children

BY 05 Aug 2015 Native Application Development

Hi,

As the sample code and screenshot, I want to set 5 px padding on the box by evas_object_size_hint_padding_set(header, ELM_SCALE_SIZE(5), ELM_SCALE_SIZE(5), ELM_SCALE_SIZE(5), ELM_SCALE_SIZE(5));. But actually it’s not working. Anyone know how to fix it? Many Thanks!!!

static Evas_Object*
create_main_view(appdata_s *ad)
{
 Evas_Object *container, *header;
 Evas_Object *entry, *button;

 container = elm_box_add(ad->conform);
 elm_box_align_set(container, 0, 0);
 evas_object_size_hint_weight_set(container, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 evas_object_size_hint_align_set(container, EVAS_HINT_FILL, EVAS_HINT_FILL);
 evas_object_show(container);
 elm_box_padding_set(container, ELM_SCALE_SIZE(5), ELM_SCALE_SIZE(5));

 header = elm_box_add(container);
 elm_box_align_set(header, 0, 0);
 elm_box_horizontal_set(header, EINA_TRUE);
 evas_object_size_hint_weight_set(header, EVAS_HINT_EXPAND, 0.0);
 evas_object_size_hint_align_set(header, EVAS_HINT_FILL, EVAS_HINT_FILL);
 evas_object_size_hint_padding_set(header, ELM_SCALE_SIZE(5), ELM_SCALE_SIZE(5), ELM_SCALE_SIZE(5), ELM_SCALE_SIZE(5));
 evas_object_show(header);
 elm_box_pack_end(container, header);

 // header content
 button = elm_button_add(header);
 elm_object_text_set(button, “i”);
 evas_object_size_hint_weight_set(button, 1, EVAS_HINT_EXPAND);
 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
 evas_object_show(button);
 elm_box_pack_end(header, button);

 entry = elm_entry_add(header);
 elm_entry_scrollable_set(entry, EINA_TRUE);
 elm_object_part_text_set(entry, “elm.guide”, “input your DA!”);
 evas_object_size_hint_weight_set(entry, 6, EVAS_HINT_EXPAND);
 evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
 evas_object_show(entry);
 elm_box_pack_end(header, entry);

 button = elm_button_add(header);
 elm_object_text_set(button, “Go!”);
 evas_object_size_hint_weight_set(button, 1, EVAS_HINT_EXPAND);
 evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
 evas_object_show(button);
 elm_box_pack_end(header, button);

 return container;
}

There isn’t padding on the top of button and entry. Possible I am use wrong api.

Written by