| 1 |
|
| 2 |
use strict; |
| 3 |
use Tk (); |
| 4 |
use Tk::TList; |
| 5 |
|
| 6 |
my $mw = Tk::MainWindow->new(); |
| 7 |
my $num = 150; |
| 8 |
$mw->Label(-text=>"\nA TList with $num widgets\n")->pack; |
| 9 |
my ($tl, $orient); |
| 10 |
$mw->Checkbutton(-command => sub{ $tl->configure(-orient=> $orient) }, |
| 11 |
-onvalue => 'horizontal', |
| 12 |
-offvalue => 'vertical', |
| 13 |
-variable => \$orient, |
| 14 |
-text => "horizontal Orientation", |
| 15 |
)->pack; |
| 16 |
$tl = $mw->Scrolled('TList', -scrollbars => 'osow'); |
| 17 |
my $sw = $tl->Subwidget('scrolled'); |
| 18 |
$tl->pack(-expand=>'yes',-fill=>'both'); |
| 19 |
my $l; |
| 20 |
foreach (1 .. $num) |
| 21 |
{ |
| 22 |
$tl->insert('end', -itemtype => 'window', -window=> $sw->Button(-text=>"**$_**") ); |
| 23 |
} |
| 24 |
Tk::MainLoop; |
| 25 |
__END__ |
| 26 |
|
| 27 |
|
| 28 |
|