Re: signal for an image



Hi ,

En ce jour du Wed, 17 May 2006 19:00:40 +0100,
Emmanuele Bassi <ebassi gmail com> parlait ainsi :
i have a seemingly simple question . I'd like to click on an image
(Gtk2::Image presumably) and have something happening (another image
appearing) .
Put the Gtk2::Image inside a Gtk2::EventBox and connect to its
'button-press-signal'; you might need to use Gtk2::Widget::add_events on
the event box, to add the 'button-press-mask'.

Sorry , 'doesn't work !

Here's (part of) the code (i know , there is no image there - yet :) :

my $scrolled = Gtk2::ScrolledWindow->new();
$frame_box->add($scrolled);
$scrolled->set_policy(qw/automatic automatic/);
$scrolled->show();
$W{scrolled} = $scrolled;

my $event = Gtk2::EventBox->new();
$event->add_events('button-press-mask');
$scrolled->add_with_viewport($event);
$event->show();
$W{event} = $event;

my $frame_label = Gtk2::Label->new("Pas d'image");
$event->signal_connect('clicked',sub{print "ok\n";});
$event->add($frame_label);
$frame_label->show();
$W{frame_label} = $frame_label;

-- 
David 'lacravate'
lacravate mongueurs net
tresorier mongueurs net

Perl en France
http://www.mongueurs.net



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]