1build::Keysyms(3) User Contributed Perl Documentation build::Keysyms(3)
2
3
4
6 Gtk2::Gdk::Keysyms - key codes for Gtk2 programs
7
9 use Gtk2;
10 use Gtk2::Gdk::Keysyms;
11
12 #
13 # the most common use is for deciphering keycodes in key events,
14 # like this:
15 #
16 sub key_press_handler {
17 my ($widget, $event) = @_;
18 if ($event->keyval == $Gtk2::Gdk::Keysyms{Escape}) {
19 abort_whatever ();
20 return 1;
21 elsif ($event->keyval == $Gtk2::Gdk::Keysyms{F1}) {
22 do_help_thing ();
23 return 1;
24 elsif ($event->keyval == $Gtk2::Gdk::Keysyms{KP_Enter}) {
25 execute_selected_text_as_command ();
26 return 1;
27 }
28 # we didn't handle it, pass it on...
29 return 0;
30 }
31
33 Gdk defines symbolic names for the codes associated with each key on a
34 keyboard, so that you don't go nuts with numeric values in your pro‐
35 grams. The hash %Gtk2::Gdk::Keysyms holds all those keycodes, indexed
36 by the name, for use in your perl programs when you need to do custom
37 key handling. This commonly occurs when you want to bind an action to
38 a key that isn't usable as an accelerator, or when you don't have
39 accelerators, or if you're trying to write an easter egg, or whatever.
40
41 As the list of keycodes is quite large and rather rarely used in appli‐
42 cation code, we've put it in a separately-loaded module to save space.
43
44 To get a list of all available keys, either dump %Gtk2::Gdk::Keysyms,
45 or look at the source of this module with "perldoc -m
46 Gtk2::Gdk::Keysyms".
47
49 This module was automatically generated by a very simple perl script
50 from gdk/gdkkeysyms.h. Programs that write programs are the happiest
51 programs of all.
52
54 Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
55 full list)
56
57 This library is free software; you can redistribute it and/or modify it
58 under the terms of the GNU Library General Public License as published
59 by the Free Software Foundation; either version 2.1 of the License, or
60 (at your option) any later version.
61
62 This library is distributed in the hope that it will be useful, but
63 WITHOUT ANY WARRANTY; without even the implied warranty of MER‐
64 CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
65 General Public License for more details.
66
67 You should have received a copy of the GNU Library General Public
68 License along with this library; if not, write to the Free Software
69 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307
70 USA.
71
73 perl(1), Gtk2(3pm)
74
75
76
77perl v5.8.8 2007-03-18 build::Keysyms(3)