| jiehuang001@hotmail.com 2005-01-26, 3:57 pm |
| Thanks so much, Marc!!!
Jie
Marc Dashevsky wrote:
> In article <1106598579.877398.246410@z14g2000cwz.googlegroups.com>,
jiehuang001
> @hotmail.com says...
from a[color=darkred]
then[color=darkred]
>
> use strict;
> use Tk;
>
> my $Frame;
> my $mw = tkinit;
> my $pane = $mw->Scrolled('Pane',
> -scrollbars => 'e',
> )->pack(-expand => 1, -fill => 'both');
> $mw->Button(
> -text => 'Refresh',
> -command => \&Refresh,
> )->pack;
> Refresh();
> MainLoop;
>
> sub Refresh {
> my @a;
> for (my $i = 0; $i < 10; $i++) {push(@a, int(rand(100)))}
> DisplayCheckButtons($pane, @a)
> }
>
> sub DisplayCheckButtons {
> my($parent, @names) = @_;
> $Frame->destroy if $Frame;
> $Frame = $parent->Frame->pack(-expand => 1, -fill => 'both');
> map {$Frame->Checkbutton(-text => $_)->pack} @names;
> }
>
> --
> Go to http://MarcDashevsky.com to send me e-mail.
|