Languages

Menu
Sites
Language
How to set width and height of box container

Hi,

I want to fix (set the width and height) the size of the box container so the when ever any widget is added it, it shoud not expand w.r.t the size of that widget, insted its width and height should remain fixed.

Any suggestion will be highly appreciated.

 

Regards,

Nikhil

Responses

2 Replies
Alex Dem

Hi,
Try to look here:
https://developer.tizen.org/dev-guide/native/2.3.0/org.tizen.mobile.native.appprogramming/html/guide/ui/container_box.htm
In my opinion: I suppose that you should set min/max sizes of internal widget (button etc)

    evas_object_size_hint_min_set(btn,w,h);
    evas_object_size_hint_max_set(btn,w,h);

which will be packed into box.
Alexey.

Carsten Haitzler

oh no no... setting min/max size hints on widgets other than grid won't work. the widget will just reset the min/mmax sizes itself.. there is just a single min and max size hint. someone owns it. in the case of all elm widgets except grid - the widget does. all you do is fight with the widget.

there are several things you could do. you could just float the toplevel (the box). and never add it as content to a parent. create it relative to the window as parent then just move and resize the box manually all you like (evas_object_move/resize()).

there is a trick to getting MORE controls that act as extra constraints which i think is what you really want.

1. create a table.

2. put basic evas rectangle object (evas_object_rectangle_add(evas_object_evas_get(win))) into table at 0, 0, 1x1

3. set min size hints on this rectangleand other hints like weight and align  - never show the rectangle

4. add your button or other child object

5. put button etc. into table at 0,0 1x1 and set weight/align as needed

6. actually show button

now take table - place table where you were going to put your button/whatever and show it etc.

does this make sense?