Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to intercept keypresses like "g" or "CTRL P", or whatever.
The following test scripts works fine under Gtk2, but under Gtk3, I get this error message:
*** Gtk3::Gdk::keyval_name: passed too many parameters (expected 1, go +t 2); ignoring excess at keyval.pl line 22. Argument "Gtk3::Gdk" isn't numeric in subroutine entry at /usr/lib/x86_64-linux-gnu/perl5/5.26/Glib/Object/Introspection.pm +line 67 (#1)
I checked the docs (at https://developer.gnome.org/); I can't see any difference between Gtk2 and Gtk3 versions of the ->keyval function.
Any ideas, oh infinitely wise ones?
#!/usr/bin/perl use strict; use diagnostics; use warnings; use Gtk3 '-init'; my $window = Gtk3::Window->new('toplevel'); $window->set_title('Hello world'); $window->set_position('center'); $window->set_default_size(500, 500); $window->signal_connect('delete-event' => sub { Gtk3->main_quit(); exit; }); $window->signal_connect('key-press-event' => sub { my ($widget, $event) = @_; print "keyval " . Gtk3::Gdk->keyval_name($event->keyval) . "\n"; }); $window->show_all(); Gtk3->main();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Use Gtk3::Gdk to intercept keypresses
by kcott (Archbishop) on Feb 13, 2019 at 05:56 UTC | |
by Anonymous Monk on Feb 13, 2019 at 09:36 UTC | |
by kcott (Archbishop) on Feb 14, 2019 at 03:06 UTC | |
by Anonymous Monk on Feb 13, 2019 at 09:51 UTC | |
by Anonymous Monk on Feb 13, 2019 at 19:07 UTC | |
|
Re: Use Gtk3::Gdk to intercept keypresses
by Anonymous Monk on Feb 12, 2019 at 20:36 UTC |