Create a simple button in EFL

An example of function which returns button with specified text label ready to pack to parent component. It also has set size and align.
#include <efl_extension.h>

static Evas_Object*
create_button(Evas_Object *parent, char *text)
{
	Evas_Object *button;
	char buf[PATH_MAX];

	button = elm_button_add(parent);
	evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0.0);
	evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
	snprintf(buf, sizeof(buf), "%s", text);
	elm_object_text_set(button, buf);
	evas_object_show(button);

	return button;
}

Responses

0 Replies