Handling button presses in Gtk2::Image objects
- by willert
I've been trying to get an Gtk2::Image object in this perl Gtk2 application to get to react to button presses, but to no avail. The image shows as expected but the button events don't get handled. What am I missing?
my $img = Gtk2::Image-new_from_file( $file );
$img-set_property( sensitive = 1 );
$img-can_focus( 1 );
$img-set_events([qw/ button-press-mask button-release-mask /]);
$img-signal_connect(
'button-press-event' = sub {
my ( $self, $event ) = @_;
print STDERR "Coords: ", $event-get_coords;
return;
});
$window-add( $img );
$window-show_all;