Why won't the menu close on mousebutton release? Want musebutton press to show the popup menu and mousebutton release to unpost it? Why doesn't this work?
use strict;
use Tk;
my $mw = tkinit;
my $mb = $mw->Menubutton(-text=>'menubutton',
)->pack;
my $menu = $mb->Menu (
-tearoff=>0,
-menuitems =>
[
['command',' item',
]
]
);
#no diff
#$menu->bindtags(undef);
$mb->bind('<Button-1>' =>
sub {
print "\nButtonpress - post menu";
my ($x,$y) = ($Tk::event->X,$Tk::event->Y);
$menu->post($x,$y);
});
$mb->bind('<ButtonRelease>' => sub {
print "\nunpost menu.";
#no diff
#$menu->grabRelease;
$menu->unpost();
});
MainLoop;