1Prima::KeySelector(3) User Contributed Perl DocumentationPrima::KeySelector(3)
2
3
4
6 Prima::KeySelector - key combination widget and routines
7
9 The module provides a standard widget for selecting a user-defined key
10 combination. The widget class allows import, export, and modification
11 of key combinations.
12
13 The module provides a set of routines, useful for conversion of a key
14 combination between representations.
15
17 my $ks = Prima::KeySelector-> create( );
18 $ks-> key( km::Alt | ord('X'));
19 print Prima::KeySelector::describe( $ks-> key );
20
22 Properties
23 key INTEGER
24 Selects a key combination in integer format. The format is
25 described in "Hot key" in Prima::Menu, and is a combination of
26 "km::XXX" key modifiers and either a "kb::XXX" virtual key, or a
27 character code value.
28
29 The property allows almost, but not all possible combinations of
30 key constants. Only "km::Ctrl", "km::Alt", and "km::Shift"
31 modifiers are allowed.
32
33 Methods
34 All methods here can ( and must ) be called without the object syntax;
35 - the first parameter must not be neither package nor widget.
36
37 describe KEY
38 Accepts KEY in integer format, and returns string description of
39 the key combination in human readable format. Useful for supplying
40 an accelerator text to a menu.
41
42 print describe( km::Shift|km::Ctrl|km::F10);
43 Ctrl+Shift+F10
44
45 export KEY
46 Accepts KEY in integer format, and returns string with a perl-
47 evaluable expression, which after evaluation resolves to the
48 original KEY value. Useful for storing a key into text config
49 files, where value must be both human readable and easily passed to
50 a program.
51
52 print export( km::Shift|km::Ctrl|km::F10);
53 km::Shift|km::Ctrl|km::F10
54
55 shortcut KEY
56 Converts KEY from integer format to a string, acceptable by
57 "Prima::AbstractMenu" input methods.
58
59 print shortcut( km::Ctrl|ord('X'));
60 ^X
61
62 translate_codes KEY, [ USE_CTRL = 0 ]
63 Converts KEY in integer format to three integers in the format
64 accepted by "KeyDown" in Prima::Widget event: code, key, and
65 modifier. USE_CTRL is only relevant when KEY first byte ( "KEY &
66 0xFF" ) is between 1 and 26, what means that the key is a
67 combination of an alpha key with the control key. If USE_CTRL is
68 1, code result is unaltered, and is in range 1 - 26. Otherwise,
69 code result is converted to the character code ( 1 to ord('A'), 2
70 to ord('B') etc ).
71
73 Dmitry Karasik, <dmitry@karasik.eu.org>.
74
76 Prima, Prima::Widget, Prima::Menu.
77
78
79
80perl v5.32.0 2020-07-28 Prima::KeySelector(3)