Search code examples
haskellgtkexpandergtk2hs

GTK Expander without fixed sizes


I am having some trouble using the GTK Expander widget. I have several expanders in a vertical box. When collapsing an expander, I want the expanders below to "shuffle" up to meet the bottom of the collapsed expander's bar. However, using VBox appears to reserve a fixed amount of vertical space for each widget, which does not change when an expander is collapsed.

As a side note, I am using GTK version 2.14.7. I am using GTK through the Gtk2Hs bindings to Haskell, GHC version 6.10.3, on Windows 7.


Solution

  • When adding the expanders to the vbox use the following snippet

    boxPackStart vbox expander PackNatural 0
    

    also make sure that when the vbox was created the homogenous flag is False.

    The default packing style is PackRepel which will distribute extra space evenly between child widgets