set_hexpand


Description:

public void set_hexpand (bool expand)

Sets whether the widget would like any available extra horizontal space.

When a user resizes a `GtkWindow`, widgets with expand=TRUE generally receive the extra space. For example, a list or scrollable area or document in your window would often be set to expand.

Call this function to set the expand flag if you would like your widget to become larger horizontally when the window has extra room.

By default, widgets automatically expand if any of their children want to expand. (To see if a widget will automatically expand given its current children and state, call [method@Gtk.Widget.compute_expand]. A container can decide how the expandability of children affects the expansion of the container by overriding the compute_expand virtual method on `GtkWidget`.).

Setting hexpand explicitly with this function will override the automatic expand behavior.

This function forces the widget to expand or not to expand, regardless of children. The override occurs because [method@Gtk.Widget.set_hexpand] sets the hexpand-set property (see [method@Gtk.Widget.set_hexpand_set]) which causes the widget’s hexpand value to be used, rather than looking at children and widget state.

Parameters:

this

the widget

expand

whether to expand