Re: Gtk2::DrawingArea

Mitchell Laks wrote:

sub key_press_event {
my $widget=shift ;
my $event=shift;
print "we got called \n";
my $keyval= $event->keyval;
if ($keyval == $Gtk2::Gdk::KeySyms{Up}) {
print "we got an up arrow yay!!! \n";



This event handler *must* return either true or false --- true if you want
event propagation to stop.  You have no explicit return here, so you're
getting an implicit return from the last expression evaluated.

Also, you need to "use Gtk2::Gdk::Keysyms;".  It's a normal perl module,
generated at build time from a gtk+ header, and not included by default to
avoid the memory hit for apps that don't do custom key event handling.

muppet <scott at asofyet dot org>

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