#!/usr/bin/perl -w use strict; use Tk; use Tk qw(exit); use TK::Menubar; use Tk::DialogBox; use Tk::Notebook; use Tk::RoText; my $top = MainWindow->new(); my $mb = $top->Menubar; my $m1 = $mb->Menubutton ( -text => 'File' ); $m1->command( -label => 'Blah 1', -command => [sub { print "Blah 1\n"; }] ); my $m2 = $mb->Menubutton ( -text => 'Orders' ); $m2->command( -label => 'View Orders', -command => [\&callback, \$top, "View orders"] ); my $m3 = $mb->Menubutton ( -text => 'Customers' ); $m3->command( -label => 'View Customers', -command => [\&callback, \$top, "View Customers"] ); my $ro = $top->ROText()->pack( -anchor => 'n', -expand => 'both'); MainLoop(); sub callback { my $t = shift || $top; my $title = shift || "Unknown"; my $FILE1 = "whatever"; my $FILE2 = "something"; my $dd = $$t->DialogBox( -title => $title ); #->Frame(); my $d = $dd->Frame()->pack(); my $n = $d->NoteBook()->pack( -expand => 0, -fill => 'x' ); #, -in => $$t); my $p = $n->add( 'page1', -label => $title ); my $e1 = $p->add( 'Entry', -width => 60, -textvariable => \$FILE1 )->pack(); my $b1 = $p->add( 'Button', -width => 10, -text => 'File 1', -command => [sub { print "$FILE1\n"; }]); my $b2 = $p->add( 'Button', -width => 10, -text => 'Details', -command => [\&callback, \$d, "Details"] ); $e1->pack(); $b1->pack(); $b2->pack(); $d->Show(); }