antoyo / relm

Idiomatic, GTK+-based, GUI library, inspired by Elm, written in Rust
MIT License
2.43k stars 78 forks source link

Label ignoring `Justify` #208

Closed MGlolenstine closed 4 years ago

MGlolenstine commented 4 years ago

I have a label set like

gtk::Box{
    border_width: 10,
    gtk::Label {
        label: "0",
        hexpand: true,
        vexpand: true,
        justify: Justification::Left,
        text: &self.model.values.get((self.model.index+0) as usize).unwrap(),
    },
},

But no matter what the justify is set to, its text will be centered. I'd like to justify the text to the left side. I think that the text should be occupying the whole width, as it's hexpand is set to true.

Edit

I found this, but I'd like to make it work for single line labels as well.

MGlolenstine commented 4 years ago

Solved it by using halign

gtk::Box{
    border_width: 10,
    gtk::Label {
        label: "0",
        hexpand: true,
        vexpand: true,
        halign: Align::Start,
        text: &self.model.values.get((self.model.index+0) as usize).unwrap(),
    },
},