Tk::NumKeypad - A Numeric Keypad widget
my $e = $mw->Entry(...)->pack; # Some entry or text widget my $nkp = $mw->NumKeypad(-entry => $e)->pack; # Numeric keypad
A numeric keypad, including a clear button and a decimal point button. This is useful for touchscreen or kiosk applications where access to a keyboard won't be available.
Math keys may be included too; and you may substitute other characters for the default keys.
The keypad is arranged as follows:
7 8 9 7 8 9 / 4 5 6 or 4 5 6 * 1 2 3 1 2 3 - . 0 C . 0 C +
The widget is designed to supply values to a Tk::Entry or Tk::Text widget. Specify the Tk::Entry or Tk::Text widget with the -entry option.
The following options/value pairs are supported:
Identifies the associated Tk::Entry or Tk::Text widget to be populated or cleared by this keypad.
Provide a hashref of substitution strings for the labels on the button keys. For example, to change the 'C' (clear) key to an 'X':
-keysub => {'C' => 'X'}
The keys still return their original values, unless you also use -keyval.
Provide a hashref of alternate values to provide for keys, that's put into your Tk::Entry or Tk::Text widget. For example,
-keyval => {'1' => 'one '}
Note that the special values 'BACKSPACE', 'CLEAR', and 'DELETE'. 'BACKSPACE' will delete one character back from the current cursor position. 'CLEAR' will clear the contents of your text or entry widget. 'DELETE' will delet the character at (after) the current cursor position.
By default, the 'C' key is associated with the 'CLEAR' action.
A popular modification of this KeyPad widget is to change the dot (.) key into a backspace key, like this:
-keysub => {'.' => "\x{21d0}"}, # this is the double-line left arrow symbol -keyval => {'.' => 'BACKSPACE'},
If true, the mathematics keys / (divide), * (multiply), - (subtraction), and + (addition) are included in the keypad.
Alias for -entry. Use of -text is preferred if the widget really is a Tk::Text.
None.
The individual buttons are advertised as "KP" + the default button label. They are KP0, KP1, ... KP9, KP. and KPC . With -math enabled, there are also KP/ KP* KP- and KP+ subwidgets. These subwidget names do not change when you substitute key labels or values.
Steve Roscio <roscio@cpan.org>
<roscio@cpan.org>
Copyright (c) 2010-2012, Steve Roscio <roscio@cpan.org>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
Because this software is licensed free of charge, there is no warranty for the software, to the extent permitted by applicable law. Except when otherwise stated in writing the copyright holders and/or other parties provide the software "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the software is with you. Should the software prove defective, you assume the cost of all necessary servicing, repair, or correction.
In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the software as permitted by the above licence, be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use the software (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the software to operate with any other software), even if such holder or other party has been advised of the possibility of such damages.
NumKeypad
To install Tk::NumKeypad, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tk::NumKeypad
CPAN shell
perl -MCPAN -e shell install Tk::NumKeypad
For more information on module installation, please visit the detailed CPAN module installation guide.