#!/Perl/bin/perl use strict; use warnings; use Tk; use Tk::Notebook; my $mw = MainWindow->new(); my $toplevel = $mw->toplevel(); # Die Menueleiste wird in den Kopf des Fensters gehaengt my $menubar = $toplevel->Menu(-type => 'menubar'); $toplevel->configure(-menu => $menubar); # Nun bauen wir ein Datei-Menue my $datei = $menubar->cascade(-label => '~Datei', -tearoff => 0 ); $datei->command(-label => 'Neu', -command => sub{newConfig()}); $datei->command(-label => 'Öffnen', -command => sub{openConfig()}); $datei->command(-label => 'Bearbeiten', -command => sub{editConfig()}); $datei->command(-label => 'Löschen', -command => sub{delConfig()}); $datei->command(-label => 'Piep', -command => [$mw=>'bell']); $datei->command(-label => 'Quit', -command => [$mw=>'destroy']); my $konfiguration = $menubar->cascade(-label => '~Konfiguration', -tearoff => 0); $konfiguration->command(-label => 'Konfiguration übernehmen', -command => sub{insertConfig()} ); MainLoop(); # ------------------------ # SUBS # ------------------------ sub newConfig { my $w = $mw->NoteBook()->pack(); my $page1 = $w->add("Neu", -anchor=>'w'); $page1->Label(-text => 'In Seite 1')->pack(); }