Positioning objects in a grid

This code snippet shows functions related to positioning elements on a grid.
static void grid_test(Evas_Object *parent) {
	Evas_Object *grid = elm_grid_add(parent);
	elm_win_resize_object_add(parent, grid);
	evas_object_show(grid);

	//add a button to the grid
	Evas_Object *center_btn = elm_button_add(grid);
	elm_object_text_set(center_btn, "center");
	evas_object_show(center_btn);

	//change button's position
	elm_grid_pack_set(center_btn, 25, 45, 50, 10);

	//get button's position
	Evas_Coord x, y, w, h;
	elm_grid_pack_get(center_btn, &x, &y, &w, &h);
	dlog_print(DLOG_INFO, LOG_TAG, "Button's position: x = %d y = %d w = %d h = %d", x, y, w, h);
	
	//get list of all of the items in the grid
	Eina_List *children = elm_grid_children_get(grid);
}

Responses

0 Replies