Reputation: 124
I'm having the following issue with GTK2:
I created two buttons with labels inside an horizontal box. (I intend to pile several hboxes) However there's an issue: When I make the box_pack functions they go like this:
gtk_box_pack_start(GTK_BOX(hbox1), button1, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox1), button2, FALSE, FALSE, 0);
Despite putting them both false, the buttons still expand vertically, making the "hbox1" ocupy all the space that is left on the parent box. I want the buttons to expand only to the minimum height required for the label to be displayed properly (like it usually happens on vertical boxes).
I heard that in GTK3 you could use the gtk_widget_set_vexpand and gtk_widget_set_hexpand functions. However, these do not seem to exist in GTK2, as they are on recognized....
Any solution for this? (Not just this case with horizontal boxes, but with the respective case in vertical boxes)
Upvotes: 3
Views: 1565
Reputation: 303
This is an older question, but an important one. In short, set the valign
property of the problematic widget to Gtk.Align.CENTER, just as @user7537486's comment on the original question said. Hope that solves it!
Upvotes: 1
Reputation: 2035
If I understood correctly, you need another hbox to behave like a expander, more or less like this:
|button|spander|
so, when you expand:
|button| spander|
button still at its minimum size....
is that what you asking for?
Upvotes: -1