Skip to content

Commit

Permalink
polish the example code
Browse files Browse the repository at this point in the history
thanks to Volker Kirsch
  • Loading branch information
dk committed Oct 5, 2024
1 parent b5bad89 commit 83f51b8
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pod/Prima/Menu.pod
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,25 @@ Prima::Menu - pull-down and pop-up menu objects
use Prima;
use Prima::Application;

my $window = Prima::Window-> new(
package MyWindow;
use base qw(Prima::MainWindow);

sub save {}

my $window = Prima::MainWindow-> new(
menuItems => [
[ '~File' => [
[ '~Open', 'Ctrl+O', '^O', \&open_file ],
[ '-save_file', '~Save', km::Ctrl | ord('s'), sub { save_file() } ],
[ '-save_file', '~Save', 'Ctrl+S', km::Ctrl | ord('s'), 'save' ],
[],
[ '~Exit', 'Alt+X', '@X', sub { exit } ],
[ 'E~xit', 'Alt+X', '@X', sub { exit } ],
]],
[ '~Options' => [
[ '*option1' => 'Checkable option' => sub { $_[0]-> menu-> toggle( $_[1]) }],
[ '*@option2' => 'Checkable option' => sub {}], # same
[],
['*(option3' => 'Either this' => sub {}],
['option4)' => 'or this one' => sub {}],
]],
[],
[ '~Help' => [
Expand All @@ -34,6 +42,8 @@ Prima::Menu - pull-down and pop-up menu objects

$window-> popupItems( $window-> menuItems);

run Prima;

=head1 DESCRIPTION

The document describes the interfaces of Prima::AbstractMenu class, and its
Expand Down

0 comments on commit 83f51b8

Please sign in to comment.