Languages

Menu
Sites
Language
Label position example doesn't work

Following the "Guide to Developing Tizen Native Application" PDF

The section "Changing the Position of a Label Using Absolute Coordinates" says to change:

elm_object_text_set(ad->label, "Hello World");
evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_content_set(ad->conform, ad->label);

to:

elm_object_text_set(ad->label, "Hello World");
evas_object_move(ad->label, 100, 200);
evas_object_resize(ad->label, 400, 100);
evas_object_show(ad->label);

Except this doesn't work on Gear S2 and the emulator. You just end up with a blank screen. I've tried playing around with the coordinate values too, incase I was pushing it off-screen.

It also doesn't explain why we're no longer calling elm_object_content_set...

Thanks.

Responses

2 Replies
Junho Lee

Please put your whole source codes to create GUI.

 

Seemanta Saha

Hello Donovan,
I have downloaded the pdf "Guide to Developing Tizen Native Application" and checked. Check the following code segments to run both on Gear S2 and emulator.

Code portion to set a label into the conformant:

ad->label = elm_label_add(ad->conform);
elm_object_text_set(ad->label, "Hello World");
evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_content_set(ad->conform, ad->label);

Code portion to show a label into a window position using Absolute Coordinates:

ad->label = elm_label_add(ad->conform);
elm_object_text_set(ad->label, "Hello World");
evas_object_move(ad->label,100,200);
evas_object_resize(ad->label,400,100);
evas_object_show(ad->label);

Mistake you were doing that you were probably using the below code segment:

ad->label = elm_label_add(ad->conform);
elm_object_text_set(ad->label, "Hello World");
evas_object_size_hint_weight_set(ad->label, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_object_content_set(ad->conform, ad->label);
evas_object_move(ad->label,100,200);
evas_object_resize(ad->label,400,100);
evas_object_show(ad->label);

Here, you were setting the label into the conformant by writing the following line:
elm_object_content_set(ad->conform, ad->label);

When you are setting the label into a conformant and at the same time using absolute positioning, the position of the label gets outside of the window. So, you do not need to set the label into the conformant rather you need to move and resize using (x, y) value of coordinate and show it writing the following line:
evas_object_show(ad->label);

Thanks
Seemanta Saha