Leiste mit Buttons

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]

logviewer.pl
my $frame = $main->Frame();
my @buttons = (
   ['QUIT', sub { close_pipe($log, $pid); exit 0 }],
   ['CUT',  sub { $logwin->delete('1.0', 'end') }],
);
foreach my $button (@buttons) {
   my $b = $frame->Button(
      '-text' => $button->[0],
      '-command' => $button->[1],
   );
   $b->pack('-side' => 'left',
      '-fill' => 'x', '-expand' => 1);
}
$frame->pack('-fill' => 'x');

$logwin->pack('-fill' => 'both', '-expand' => 1);

MainLoop;

*Buttons und ggf. auch andere Widgets, die in größeren Quantitäten auftreten, werden am geschicktesten in Abhängigkeit einer kompakten Datenstruktur angelegt.
 

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]
Copyright © 1996, 1998, 1999, 2000 Andreas Borchert, in HTML konvertiert am 07.02.2000