skywalker has asked for the wisdom of the Perl Monks concerning the following question:
any help would be greatly appeciated#set up main window display use Tk; $mw = new MainWindow(-title => 'PopUp'); @buttons = qw(A B C D E F G); #popup menu set up $popupmenu = $mw->Menu(-tearoff => 0); for (my $ctr = 0; $ctr <@buttons; $ctr++){ $popupmenu->insert(1, 'command', -label => $buttons[$ctr], -command => [sub {print $popupmenu->cget('text') ."\n"}], ); } $mw->bind("<Button-3>" => sub {$popupmenu->Popup(-popover => "curso +r", -popanchor => 'nw' +) -command => [sub { +print "Popup\n"}]}); MainLoop();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dynamic Popup Menus
by zentara (Cardinal) on Sep 29, 2008 at 20:50 UTC | |
by skywalker (Beadle) on Sep 30, 2008 at 12:58 UTC |