How to disable all keys except <Enter>?
- From: Lumir Jasiok <lumir jasiok vsb cz>
- To: gtk-perl-list gnome org
- Subject: How to disable all keys except <Enter>?
- Date: Thu, 29 Mar 2007 12:29:30 +0200
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):
$window->signal_connect( 'key-press-event' => \&disable_keys);
...
sub disable_keys
{
my ($widget,$event,$parameter)= @_;
my $key_nr = $event->keyval();
foreach my $key (keys %Gtk2::Gdk::Keysyms){
my $key_compare = $Gtk2::Gdk::Keysyms{$key};
if($key_compare == $key_nr){
print ("You typed $key \n");
if($key_nr == 65293) {
# Do something more ...
} else {
# Do nothing
}
last;
}
return FALSE;
}
But without success. It looks like the &disable_keys function isn't
called by 'key-press-event'. What I am doing wrong?
Regards
Lumir
--
Lumír Jasiok
VSB-TU Ostrava - Computer centre
E-mail: lumir jasiok vsb cz
http://www.vsb.cz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]