It depends on what you are doing, but in most cases, I can't see why you wouldn't be using Win32::GUI::Dialog() anyway.
Here is the above code modified to use Win32::GUI::Dialog():
use strict; use Win32::GUI (); $|=1; my $window = Win32::GUI::Window->new(); my $menu = new Win32::GUI::Menu( "mymenu" => "mymenu", " > foo" => "foo", " > bar" => { -name => 'bar', -onClick => \&bar_onclickcallback + }, ); print "Start Tracking\n"; $window->TrackPopupMenu($menu->{mymenu}, 20,20); Win32::GUI::Dialog(); # enter Dialog() here print "Done Tracking, if it didn't print 'GOTCHA ...' then no callback +?\n"; sub bar_onclickcallback { print "GOTCHA bar\n"; return -1; # return -1 here to exit from dialog loop } sub foo_Click { print "GOTCHA foo\n"; return -1; # return -1 here to exit from dialog loop }
In reply to Re^3: Win32::GUI Popup Menu no callback
by kejohm
in thread Win32::GUI Popup Menu no callback
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |