Questions about St.Label
- From: César García Tapia <tapia openshine com>
- To: gnome-shell-list gnome org
- Subject: Questions about St.Label
- Date: Thu, 21 Jun 2012 14:29:13 +0200
Hi.
I'm working in a shell extension, but I have some problems with St.Label sizing and positioning.
First problem: I want to vertical-align a label inside a container (St.BoxLayout, if it helps). I've tried this:
let box = new St.BoxLayout ();
box.add (some_really_high_widget);
let label = St.Label ();
label.set_text ("blah blah");
box.add (label, {expand: true, y_fill: true, y_align: St.Align.MIDDLE});
but nothing happens. The label is shown in the top of the widget, not vertical centered.
Second problem: I need a multi-line label, to show a long string. But all I get is a one-line label, it doesn't resize to fit all the text. The code:
label = new St.Label ();
label.clutter_text.line_wrap = true;
label.clutter_text.line_wrap_mode = Pango.WrapMode.WORD;
label.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
label.set_text ("some really long text");
container.add (label, {expand:true});
But it only shows the first line. The ellipsis is OK, and if I force the label height through the stylesheet.css, it shows all the lines. But it's not a good idea, since I don't know the length of the string.
Any idea about how could I solve this two problems?
Thank you very much.
César García Tapia
+34 663 273 481
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]