I've only see the mouse x, y event, and the keyboard event $e->K.
#!/usr/bin/perl
use warnings;
use strict;
use Tk;
my $down = 0;
my $mw = MainWindow->new;
$mw->bind("<Key>", sub { &pressed } );
$mw->bind("<KeyRelease>", sub { &released } );
MainLoop;
sub pressed{
my($widget) = @_;
my $e = $widget->XEvent; # get reference to X11 event structure
my $binding = 'Character = ' . $e->N . ', keysym = ' . $e->K . '.';
print "$binding\n";
print $e->K," pressed\n";
}
sub released{
my($widget) = @_;
my $e = $widget->XEvent; # get reference to X11 event structure
my $binding = 'Character = ' . $e->N . ', keysym = ' . $e->K . '.';
print "$binding\n";
print $e->K," released\n";
}
not sure why I (or anyone) bother persisting with using this stuff--it's just painful. Well because it is seldom needed to delve into it with any depth.... it's just your mouse and keyboard events and it works almost everytime. So it's like your default keymap defs, I use them all the time, but it's a real pain to try to figure out the low level stuff it involves..... termcap, locale, unicode..... painful. Perl/Gtk2 gets even more painful in this regard, because everthing in it is an event, and there are chains-of-events to work thru to get something. By comparison, Tk is easy.
|