语言

Menu
Sites
Language
How do i Resize a button: Button is bigger than screen - Circle Wearables

this seems to be a little more difficult then it should be.

I been at it for a couple of day and i cant figure it out. Everytime i put a button in the circle screen, it always outside the screen or bigger than the screen.

How do i resize a button? How do i resize a Box?

编辑者为: Mark Stoge 03 2月, 2017
查看选择的答案

响应

6 回复
Mark as answer
Shaswati Saha

You may resize an evas object using the evas_object_resize() function. For example, to resize a button you may try using the code below. I've tried to adjust it by changing width, height, font size, etc. in  such a way so that it can prevent the button object from going outside the screen.

Evas_Object *btn = elm_button_add(ad->conform);
elm_object_text_set(btn,"<font_size=20>Button</font_size>");
evas_object_resize(btn, 360 / 2, 360 / 18);
evas_object_move(btn, 360 / 3 , 360 / 3 + 40);
evas_object_show(btn);

 

Mark Stoge

This doesn't work for me. the buttons dont even move, let alone resize.

Mark Stoge

does the resize function work on wearables?

Mark Stoge

disregard. I figured out the problem. I was using a naviframe. Unless i am doing it wrong,  I guess the resize(), and move() functions dont work with naviframe.

 

Thank you for your time

Shaswati Saha

Here's my one. Please have a look in the link below.

http://imgur.com/1B5w3Ga

Mark Stoge

Awesome..

do i need to put my 'button in a container'?

do you mind sharing the code with me so i can compare to what i am doing wrong?

here is my 'Create base GUI function':

 

static void
create_base_gui(appdata_s *ad)
{
    /* Window */
	ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
	elm_win_autodel_set(ad->win, EINA_TRUE);

	if (elm_win_wm_rotation_supported_get(ad->win)) {
		int rots[4] = { 0, 90, 180, 270 };
		elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
	}

	evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
	/*eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);*/

	/* Conformant */
	ad->conform = elm_conformant_add(ad->win);
	elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
	elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
	evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
	elm_win_resize_object_add(ad->win, ad->conform);

	evas_object_show(ad->conform);

	/*Naviframe*/
	ad->naviframe = elm_naviframe_add(ad->conform);
	elm_object_content_set(ad->conform, ad->naviframe);
	evas_object_show(ad->naviframe);

	//Button
	ad->Button = elm_button_add(ad->naviframe);
	elm_object_style_set(ad->Button, "default");
	elm_object_text_set(ad->Button, "Record");
	evas_object_move(ad->Button, .5 , .5);

	elm_naviframe_item_push(ad->naviframe, "", NULL, NULL, ad->Button, NULL);

	evas_object_show(ad->win);


}

 

Thanks in advance.