Prima::KeySelector - key combination widget and routines
The module provides a standard widget for selecting user-defined key combinations. The widget class allows import, export, and modification of key combinations. The module also provides a set of routines useful for the conversion of key combinations between various representations.
my $ks = Prima::KeySelector-> create( ); $ks-> key( km::Alt | ord('X')); print Prima::KeySelector::describe( $ks-> key );
Selects a key combination in integer format. The format is described in "Hotkey" in Prima::Menu, and is a combination of the km::XXX key modifiers and is either a kb::XXX virtual key or a character code value.
km::XXX
kb::XXX
The property allows almost, but not all possible combinations of key constants. Only the km::Ctrl, km::Alt, and km::Shift modifiers are allowed.
km::Ctrl
km::Alt
km::Shift
All methods must be called without the object as a first parameter.
Accepts KEY in integer format and returns a string description of the key combination in a human-readable format. Useful for supplying an accelerator text to a menu.
print Prima::KeySelector::describe( km::Shift|km::Ctrl|km::F10); Ctrl+Shift+F10
Accepts KEY in integer format and returns a string with a perl-evaluable expression, which after the evaluation resolves to the original KEY value. Useful for storing a key into text config files, where the value must be both human-readable and easily passed to a program.
print Prima::KeySelector::export( km::Shift|km::Ctrl|km::F10); km::Shift|km::Ctrl|km::F10
Converts KEY from integer format to a string, acceptable by Prima::AbstractMenu input methods.
Prima::AbstractMenu
print Prima::KeySelector::shortcut( km::Ctrl|ord('X')); ^X
Converts KEY in integer format to three integers in the format accepted by the "KeyDown" in Prima::Widget event: code, key, and modifier. USE_CTRL is only relevant when the KEY first byte ( KEY & 0xFF ) is between 1 and 26, which means that the key is a combination of an alpha key with the control key. If USE_CTRL is 1, the code result is unaltered and is in range 1 - 26. Otherwise, the code result is converted to the character code ( 1 to ord('A'), 2 to ord('B'), etc ).
KEY & 0xFF
Dmitry Karasik, <dmitry@karasik.eu.org>.
Prima, Prima::Widget, Prima::Menu.
To install Prima, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Prima
CPAN shell
perl -MCPAN -e shell install Prima
For more information on module installation, please visit the detailed CPAN module installation guide.