Greetings! Is there a way of getting a Tk Scrolled (Subwidget) Pane to automatically resize up to a limit (typically screen limitations)? It seems the dimensions of the Tk Scrolled widget needs to be specified explicitly, either when defining the widget or later using -configure(). I would want my main window and all contained widgets to expand with my dynamically defined Scrolled widget contents, and the scrollbars appear only when there is no place left to expand. Using Strawberry 5.32 on a Win32 system.
use Tk; use Tk::HList; use Tk::Pane; use strict; my $Window = MainWindow->new(); $Window->geometry("+0+0"); $Window->maxsize(1000,1200); $Window->minsize(400,300); my $tab = $Window; my $scroll = $tab->Scrolled('Pane', -sticky => 'news', -scrollbars => 'osoe', ); $scroll->pack; my $pane = $scroll->Subwidget("scrolled"); my $grid = $pane->HList( -columns => 13, -width => 0, # Causes scrollbar to appear -height => 0 # Causes scrollbar to appear ); $grid->pack(); $scroll->pack(-expand => 1, -fill => 'both'); foreach my $row (0..10) { $grid->addchild(""); foreach my $col (0..12) { my $wid = $grid->Entry( -text => "Whatever", -width => 0, ); $wid->pack; $grid->itemCreate ($row, $col, -itemtype => 'window', -widget => $wid); } } #$pane->configure(-height => '1000', -width => '1000'); # Works, but s +hould be handled by pack MainLoop;
In reply to Tk autosizing Scrolled widgets by olgo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |