Hi.
I'm new to PerlTk.
What I'm trying to achieve is getting the message "oval was pressed" even when I press the rectangle.
Below there a simplified version of the code.
require v5.8.5;
use Tk;
my $window = MainWindow->new;
my $drawing = $window->Canvas(-width => 400, -height => 300, -background => "white") -> pack;
$ov = $drawing->createOval(100,50,300,250,-fill=>"black");
$rec = $drawing->createRectangle(150,100,250,200,-fill=>"white");
$drawing-> bind( $ov, '<Button-1>',sub{$window -> messageBox(-type=>"ok", -message=>"oval was pressed");});
MainLoop;
Thanks!
I'm new to PerlTk.
What I'm trying to achieve is getting the message "oval was pressed" even when I press the rectangle.
Below there a simplified version of the code.
require v5.8.5;
use Tk;
my $window = MainWindow->new;
my $drawing = $window->Canvas(-width => 400, -height => 300, -background => "white") -> pack;
$ov = $drawing->createOval(100,50,300,250,-fill=>"black");
$rec = $drawing->createRectangle(150,100,250,200,-fill=>"white");
$drawing-> bind( $ov, '<Button-1>',sub{$window -> messageBox(-type=>"ok", -message=>"oval was pressed");});
MainLoop;
Thanks!