in reply to Re: Win32::GUI Popup Menu no callback
in thread Win32::GUI Popup Menu no callback

That is workable (if you define/import TPM_LEFTALIGN | TPM_TOPALIGN | TPM_LEFTBUTTON,), or call  Win32::GUI::Dialog(); as per Win32::GUI::Tutorial::Part1

Replies are listed 'Best First'.
Re^3: Win32::GUI Popup Menu no callback
by kejohm (Hermit) on Jun 28, 2010 at 11:58 UTC

    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 }