Re: How to disable all keys except <Enter>?
- From: Lumir Jasiok <lumir jasiok vsb cz>
- To: zentara <zentara1 sbcglobal net>
- Cc: gtk-perl-list gnome org
- Subject: Re: How to disable all keys except <Enter>?
- Date: Thu, 29 Mar 2007 18:28:32 +0200
zentara wrote:
On Thu, 29 Mar 2007 12:29:30 +0200
Lumir Jasiok <lumir jasiok vsb cz> wrote:
Hi,
I need to disable in my program all keyboard events excluding <Enter>
key. I need to disable the GNOME keyboard shortcuts etc. It should look
like gksu application. Is there any way to do this? I'm trying this code
(stolen from gtk2-perl study guide):
But without success. It looks like the &disable_keys function isn't
called by 'key-press-event'. What I am doing wrong?
Regards
Lumir
Hi, this works for me on linux.
#!/usr/bin/perl
use warnings;
use strict;
use Gtk2;
use Glib qw/TRUE FALSE/;
use Gtk2::Gdk::Keysyms;
use Gtk2 -init;
my $window = Gtk2::Window->new;
$window->signal_connect( 'key_press_event' => \&process_entry_keypress );
$window->signal_connect( 'destroy' => sub { Gtk2->main_quit } );
$window->show;
Gtk2->main;
sub process_entry_keypress {
my ( $widget, $event ) = @_;
if (
$event->keyval == $Gtk2::Gdk::Keysyms{ Return } ||
$event->keyval == $Gtk2::Gdk::Keysyms{ KP_Enter }
) {
print "An Enter key has been pressed!\n";
}
return FALSE;
}
__END__
zentara
Thx. for your code, but in MY case it's not working. I have the $window
defined as 'popup' and in this case does'n working
signal_connect->( 'key_press_event' ...
Do you have any idea how to implement fullscreen window which has
disabled all keyboard events?
Lumir
--
Lumír Jasiok
VSB-TU Ostrava - Computer centre
Tel: +420 59 732 3189
E-mail: lumir jasiok vsb cz
http://www.vsb.cz
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]