--- ~~Title:UI Sizing Programming Guide~~ --- # User Interface Sizing Programming Guide # Sometimes when building a *user interface (UI)* you need to set the size of some elements to non-default values. A common pitfall is to explicitly set these sizes to values that look OK in a development environment but then fail for other users when the UI is resized. A better approach is to set *minimum* and *maximum* values for the size of these elements. This means they can be customized while still allowing for some flexibility. You can find an usage example in the [EFL examples repository](https://git.enlightenment.org/enlightenment/examples) in [reference/c/ui/src/ui_sizing.c](https://git.enlightenment.org/enlightenment/examples/src/branch/master/reference/c/ui/src/ui_sizing.c). ## Prerequisites ## * Read the [Hello GUI Tutorial](/develop/tutorials/c/hello-world-gui.md) to learn how to build a simple EFL application with a Graphical User Interface. ## Setting a Widget's Minimum Size ## When a widget's *minimum* size is defined with ``efl_gfx_size_hint_min_set()``, resizing the rest of the UI will not shrink the widget below the size you set. You can use it to create elements which are bigger than normal, as well as prevent the UI from becoming too small: ```c efl_add(EFL_UI_BUTTON_CLASS, win, efl_text_set(efl_added, "Big Button"), efl_pack_end(box, efl_added), efl_gfx_size_hint_min_set(efl_added, EINA_SIZE2D(100, 100))); ``` ## Setting a Widget's Maximum Size ## When a widget's *maximum* size is defined with ``efl_gfx_size_hint_max_set()``, resizing the rest of the UI will not expand the widget above this size you set. Use it to create elements which are smaller than normal or that will not expand past a given point when the UI enlarges. ```c efl_add(EFL_UI_BUTTON_CLASS, win, efl_text_set(efl_added, "Small"), efl_pack_end(box, efl_added), efl_gfx_size_hint_max_set(efl_added, EINA_SIZE2D(50, 50))); ``` ## Further Reading ## [Hello GUI Tutorial](/develop/tutorials/c/hello-world-gui.md) : Basic tutorial explaining how to build a simple EFL application with a Graphical User Interface.