use Tk 800; use Tk::Dialog; use event; use icit_messages; $top = new MainWindow; $top->title("As2Con Gui"); my $frame = $top->Frame(qw/-width 800 -height 300 -background white/)->pack; create_gui(); sub create_gui { $menubar = $top->Menu; $status_menu->command(-label => "~Events", -command => sub { event_function(\$frame) }); $status_menu->command(-label => "M~essages", -command => sub { messages_function(\$frame) }); .... #### sub event_function { my $top = shift; if ($view) { $view->packForget } $view = $$top->Frame(qw/-width 800 -height 400 -background white/)->pack(-expand => 1, -fill => 'both'); ... #### sub messages_function { my $top = shift; if ($view) { $view->packForget; } $view = $$top->Frame(qw/-width 400 -height 400 -background white/)->pack(); ...