It often depends on what widget you are using and what is focused at the time of the right-click. Some widgets will have built-in bindings for different mouse clicks, like the Tk::Text widget. Play with this, and notice the difference when you uncomment the line
Tk::break.
#!/usr/bin/perl
use warnings;
use Tk;
use strict;
my $main = new MainWindow;
$main->geometry('200x200');
$main->Button(-text=>"click",-command=>sub{
print "Button left click\n";
})->pack;
$main->bind('Tk::Button', '<ButtonRelease-3>', \&some_sub);
$main->bind('<ButtonRelease-3>', \&some_other_sub);
MainLoop;
sub some_sub{
print 'Button ',scalar gmtime,"\n";
#Tk::break; #stops the main window binding from activating
}
sub some_other_sub{
print 'main window ',scalar gmtime,"\n";
}
|