Special_K has asked for the wisdom of the Perl Monks concerning the following question:
I am just getting started with Tk to make GUIs in Perl and am trying to make a button with a menu that appears when the user left-clicks on it. The following code does not produce any behavior when the button is left-clicked:
$pm->command(-label=>"rerun", -command=>[\&rerun, $dataset] ); $button->bind('<ButtonRelease-1>' => [ sub { push @menulist, $pm; $pm- +>post( $_[1], $_[2] ) }, Ev('X'), Ev('Y') ] );
On the other hand, the following does produce the desired menu when the button is right-clicked:
$pm->command(-label=>"rerun", -command=>[\&rerun, $dataset] ); $button->bind('<ButtonRelease-3>' => [ sub { push @menulist, $pm; $pm- +>post( $_[1], $_[2] ) }, Ev('X'), Ev('Y') ] );
If ButtonRelease-3 corresponds to the right mouse button, what corresponds to the left mouse button, if not ButtonRelease-1? I also tried ButtonRelease-2 but that didn't do anything either.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk : how to map ButtonRelease to left mouse button?
by Discipulus (Canon) on Apr 01, 2019 at 19:55 UTC | |
|
Re: Tk : how to map ButtonRelease to left mouse button?
by tybalt89 (Monsignor) on Apr 01, 2019 at 20:36 UTC |