# This demonstration script creates a window with a bunch of menus
# and cascaded menus, but uses the unique Perl/Tk -menuitems way.
# A <<MenuSelect>> virtual event tracks the active menu item.
my ($demo) = @_;
$TOP = $MW->WidgetDemo(
-name => $demo,
-text => ['', -wraplength => '5i'],
-title => 'Menuitems Demonstration',
-iconname => 'menus2',
);
my $ws = $TOP->windowingsystem;
my $text = ($ws eq 'classic' or $ws eq 'aqua') ?
'This window contains a menubar with cascaded menus. You can invoke entries with an accelerator by typing Command+x, where "x" is the character next to the command key symbol. The rightmost menu can be torn off into a palette by dragging outside of its bounds and releasing the mouse.' :
'This window contains a menubar with cascaded menus. You can post a menu from the keyboard by typing Alt+x, where "x" is the character underlined on the menu. You can then traverse among the menus using the arrow keys. When a menu is posted, you can invoke the current entry by typing space, or you can invoke any entry by typing its underlined character. If a menu entry has an accelerator, you can invoke the entry without posting the menu just by typing the accelerator. The rightmost menu can be torn off into a palette by selecting the first item in the menu.';
$TOP->configure(-text => $text);
my $toplevel = $TOP->toplevel; # get $TOP's Toplevel widget reference
my $menubar = $toplevel->Menu(-type => 'menubar');
$toplevel->configure(-menu => $menubar);
my $modifier;
if ( $ws eq 'classic' or $ws eq 'aqua') {
$modifier = 'Command';
} elsif ($Tk::platform eq 'windows') {
$modifier = 'Control';
} else {
$modifier = 'Meta';
}
my $f = $menubar->Cascade(qw/-label ~File -tearoff 0 -menuitems/ =>