Re: [gtk-list] Gtk-Perl $event->{keyval}



Noonian wrote:
> 
> Greetings!
> 
> I've been wondering how one determines in a system-independent way what
> keyval corresponds to what key in the Perl Gtk bindings.  Currently, I'm
> using something like this (which is really ugly for several reasons):
> 
> sub key_press_event {
>     my ($clist, $self, $event) = @_;
>     if ($event->{keyval} == 65535) { #FIXME

I would try something like:

use Gtk::Keysyms;
...
if ($event->{'keyval'} == $Gtk::Keysyms{'Delete'}) {
...

The Gtk::Keysyms module is generated for the target machine at Gtk-Perl 
build time so I reckon that this method should be portable. Someone please
correct me if I am wrong. 

You can read the Gtk/Keysyms.pm file for the other keysyms that will have
been generated.

Regards, Dermot




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