Re: Vertically aligning components in St

2013/3/2 Jason Heeris <jason heeris gmail com>:
I've been trying to vertically align components in an St.BoxLayout
(with vertical = false), but nothing I do seems to have any affect.
I've tried setting 'vertical-align' in the CSS for a component, and
setting y_align and y_expand on both the components and the BoxLayout.
The components always end up aligned along the top edge of the

CSS vertical-align is not implemented, and StBoxLayout doesn't use the
standard [xy]_align and [xy]_expand properties.
Instead, it uses [xy]_align and [xy]_fill child properties, that you
can set with .add(actor, { y_align: St.Align.MIDDLE }).
Alternatively, you can use a regular StWidget and set a
ClutterBoxLayout layout manager. That would honor the align and expand
properties on the actor.

How can I vertically centre components? Or better yet, can I align
text-based components (eg. labels and text fields) along the text

Unfortunately, baseline alignment is not implemented anywhere in the
gnome libraries. See
for a discussion of implementing it in gtk+, but it'll take time
before its copied to St as well.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]