Page MenuHomePhabricator

Elementary: invalid text alignment when inside a box
Closed, InvalidPublic


Look at the hello world tutorial example:

It creates a vertical box with a text and a button, and the text is center-aligned both vertically and horizontally:

efl_gfx_size_hint_align_set(efl_added, 0.5, 0.5)

However, it is only centered horizontally. Using Clouseau, you can see that the text widget uses up all the available vertical space, so there's no room for it to align.

If the box is made horizontal, the problem is reversed: The text is correctly aligned vertically, but not horizontally.

segfaultxavi triaged this task as Normal priority.

The behavior you see is correct, size_hints are meant to size and position the object itself, not it's content (in this case you are aligning the text object bounding box).

To change the text alignment (inside the text object) you need to use the text api:

efl_text_valign_set(efl_added, 0.5),

Just add this line to the EFL_UI_TEXT_CLASS constructor to vertically align the text as you prefer

segfaultxavi closed this task as Invalid.Aug 29 2018, 1:13 AM

OK, your explanation convinces me. I will explain this in the tutorials. Thanks!

Great, thanks for taking care of the tutorial :)