Languages

Menu
Sites
Language
Get the Geomatrical size of a scroller

How do I get the geomatrical size of a Scroller .
I am using this but it is not working

     evas_object_geometry_get(bubble_scroller, NULL, NULL, &w, &h);
     dlog_print(DLOG_INFO, "SIZE", "scroller size, [%d,%d]", w, h);


Please Help.

Responses

6 Replies
Vikram

Hi,

I've test the API evas_object_geometry_get(), seems it not works correct on scoller, but it's ok on box. 

In my case, I create the scoller by call elm_scroller_add(), and add a box as its children, insert some text content to the box (such as multi-line text label).

Log output as below, first line is the size of scoller, and second line is the size of box.

07-03 13:53:03.432 : INFO / test ( 26280 : 26280 ) : scroller size, [-14,55,30,0]
07-03 13:54:42.292 : INFO / test ( 26865 : 26865 ) : box size, [-14,55,246,1671]

Sample code:

int x, y, w, h;
evas_object_geometry_get(ad->box, &x, &y, &w, &h);
dlog_print(DLOG_INFO, LOG_TAG, "scroller size, [%d,%d,%d,%d]", x, y, w, h);

 

Mosharraf Hossain

I have also used
 

 elm_scroller_region_get(bubble_scroller, &xx, &yy, &w, &h);

It is not working. Is there any way to get the scroller size.
 

Alex Dem

Hi,
The size of the scroller depends on the size of the parent. I was able to get scroller size with:

evas_object_geometry_get(scroller,&x,&y,&w,&h);

but only after scroller was placed into naviframe parent container. Also, this approach do not work in all cases.

In accordance with dev-guide:
https://developer.tizen.org/dev-guide/2.3.0/org.tizen.guides/html/native/ui/containers_n.htm#scroller
you should add:

evas_object_event_callback_add(scroller, EVAS_CALLBACK_RESIZE, _scroller_resize_cb, NULL);

and get scroller params inside CB with:

Evas_Coord x,y,w,h;
evas_object_geometry_get(obj,&x,&y,&w,&h);

Alexey.

Mosharraf Hossain

Hi
I used below
 

evas_object_event_callback_add(bubble_scroller, EVAS_CALLBACK_RESIZE, _scroller_resize_cb, NULL);


void   _scroller_resize_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
  {
    Evas_Coord x,y,w,h;
 evas_object_geometry_get(obj,&x,&y,&w,&h);
 dlog_print(DLOG_DEBUG, "SIZE", "scroller size, [%d, %d, %d,%d]", x, y, w, h);

  }

and it prints two different sizes of the scroller
01-01 05:32:44.060 : DEBUG / SIZE ( 3551 : 3551 ) : scroller size, [0, 108, 180,560]
01-01 05:32:44.080 : DEBUG / SIZE ( 3551 : 3551 ) : scroller size, [0, 108, 480,576]
 

which one should i take ?

Alex Dem

Hi,
I guess it could be calculated sizes of scroller for landscape and portrait orientations. But no description in dev-guide regarding this case.
Alexey.

Carsten Haitzler

take the size at the time. the scroller will adjust size as widgets are packed into the window, asdn as the window itself is laid out and resized. if the screen rotates then this would resize. if your window was floating - it could resize, thus scroller resize. if it was on a desktop ui the window could resize any time. the toolkit is built to handle the complex cases of fully resizable windows resizing at any time - so listening to the callbacks and adapting at the time is the best way.