Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
map {$menubar->cascade( -label => '~' . $_->[0], -menuitems => $_->[1] + )} ['File', file_menuitems], ['Edit', edit_menuitems]; #my $file = $menubar->cascade( # -label => '~File', -menuitems => file_menuitems); # #my $edit = $menubar->cascade( # -label => '~Edit', -menuitems => edit_menuitems); # #my $help = $menubar->cascade( # -label => '~Help', -menuitems => help_menuitems); if ($^O eq 'MSWin32') { my $syst = $menubar->cascade(-label => '~System'); my $dir = 'dir | sort | more'; $syst->command( -label => $dir, -command => sub {system $dir}, ); } my $file_menu = $menubar->entrycget('File', -menu); sub edit_menuitems { [ [qw/command ~Undo -accelerator Ctrl-u -c +ommand/ => \&undo_text], [qw/command ~Redo -accelerator Ctrl-r -c +ommand/ => \&redo_text], '', [qw/command ~Copy -accelerator Ctrl-c +-command/ => \©_text], [qw/command ~Cut -accelerator Ctrl-x +-command/ => \&cut_text], [qw/command ~Paste -accelerator Ctrl-p +-command/ => \&paste_text], '', [qw/command/, '~Select All', qw/ -accelerator Ct +rl-s -command/ => \&select_all], [qw/command/, 'S~electToLine ...', qw/ -accelerator +Ctrl-e -command/ => \&select_line], [qw/command ~GoTo -accelerator Ctrl-g - +command/ => \&goto_line], [qw/command/, '~Line Number', qw/ -accelerator Ctrl- +l -command/ => \&line_number], '', [qw/command ~Find -accelerator Ctrl-f - +command/ => \&find], [qw/command/, 'F~ind Replace', qw/ -accelerator Ctrl +-i -command/ => \&find_replace], ]; } sub file_menuitems { # Create the menu items for the File menu. [ [qw/command/, '~Load Files for Sorting', qw/ -accelerator + Ctrl-l -command/ => \&load_file], [qw/command/, '~Unload Files', qw/ -accelerator C +trl-u -command/ => \&unload_file], [qw/command/, '~Open a File to View', qw/ -accele +rator Ctrl-o -command/ => \&open_file], '', [qw/command ~Save -accelerator Ctrl-s + -command/ => \&save_file], [qw/command/, 'S~ave As ...', qw/ -accelerato +r Ctrl-a -command/ => \&save_file_as], '', [qw/command ~Close -accelerator Ctrl-w + -command/ => \&close_file], '', [qw/command ~Quit -accelerator Ctrl-q + -command/ => \&exit], ]; } # end file_menuitems
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Menubars the slick, sophisticated, New-Fashioned way
by converter (Priest) on Nov 20, 2002 at 00:21 UTC | |
by Anonymous Monk on Nov 20, 2002 at 07:59 UTC | |
|
Re: Menubars the slick, sophisticated, New-Fashioned way
by BrowserUk (Patriarch) on Nov 19, 2002 at 23:31 UTC |