Betrachter für kleine Datenbanken VI

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

dbviewer.pl
sub setup_widgets {
   my $main = new MainWindow;
   my $quit = $main->Button(
      '-text' => 'QUIT', '-command' => sub { exit });
   $quit->pack('-fill' => 'x');
   my $listbox = $main->Scrolled('Listbox' =>
      '-scrollbars' => 'w', '-width' => $maxtitlelen,
      '-height' => @{$db} > 5? 5: scalar @{$db},
   );
   $listbox->insert('end', @{$titles});
   $listbox->bind('<Button-1>',
      sub { select_record($listbox->index('anchor')) });
   $listbox->pack('-fill' => 'both', '-expand' => 1);
   foreach my $col (0..$maxcols-1) {
      my $frame = $main->Frame();
      my $label = $frame->Label(
         '-text' => $fieldnames[$col],
         '-width' => $maxfieldnamelen,
         '-anchor' => 'w',
      );
      $label->pack('-side' => 'left');
      my $field = $frame->Label(
         '-textvariable' => \$fields[$col],
         '-relief' => 'sunken',
         '-width' => 50, '-anchor' => 'w',
      );
      $field->pack(
         '-side' => 'left', '-fill' => 'x', '-expand' => 1);
      $frame->pack('-fill' => 'x');
   }
}

 [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