Languages

Menu
Sites
Language
How to set image for button

Hi all ,

Can any one explain how to set the image for button using EFL
i want to use image buttons in my application.
Thanks in advance
Regards
Harish K

Responses

2 Replies
Alex Dem

Hi,
Try something like this (example is for default style):
 

    btn = elm_button_add(box);
    img = elm_image_add(btn);
    elm_image_file_set(img, ICON_DIR"/iu.png", NULL);
    elm_image_resizable_set(img, EINA_TRUE, EINA_TRUE);
    elm_object_part_content_set(btn, "icon", img);
    evas_object_size_hint_min_set(btn, ELM_SCALE_SIZE(150), ELM_SCALE_SIZE(58));
    evas_object_smart_callback_add(btn, "clicked", btn_clicked_cb, (void *)4);
    evas_object_show(btn);
    elm_box_pack_end(box, btn);

where ICON_DIR is

#define ICON_DIR "/opt/usr/apps/org.tizen.uicontrolsapp/res/images"


and 'org.tizen.uicontrolsapp' is your app id.

Alexey.

Jean Yang

Hi, 

Just add one info , the default style image button will have a bule circle around your image, you can set he min&max size of image then can cover the bule part.

 

    evas_object_size_hint_min_set(icon, 100, 100);
    evas_object_size_hint_max_set(icon, 100, 100);