My original post was a greatly simplified version. A bit more complicated is this:
I have to use grid because with two listboxes below I need labels to stick out nicely right above corresponding lists. And I want one scrollbar to scroll both lists:
$top = new MainWindow;
$f = $top->Frame;
$f->Label(-text=>"1")->grid('x',$f->Label(-text=>"2"));
$f->Listbox()->grid($f->Scrollbar(),$f->Listbox());
$f->pack(-side=>'left');
MainLoop;
Even with one Listbox it appeared that I cannot control how scrollbar is shown in grid. Or, can I? | [reply] [d/l] |
To get your widgets to stretch using the grid manager, you need to specify the -sticky attribute. Basically for a given widget, you tell grid which sides (n,s,e,w) should "stick", and it makes sure those sides of the widget always touch the appropriate border of the widget's grid cell. In this case, you want the scrollbar to extend all the way from the top of the cell to the bottom, so you want the top (n) and bottom (s) of the widget to stick:
$f->Listbox()->grid($f->Scrollbar(), -sticky => 'ns');
| [reply] [d/l] |
Yes, that's what I wanted. Thanks to everyone.
| [reply] |