I need a text box setting in perlTk such that i can enter 2 digit number with automatically added separator.
Eg. if there are 5 entries of two digits number namely 52, 25, 69, 45, 15, in text box if i enter these five 2 digits numbers the separator (-) should automatically added after every two digit entry.
and final entry would look like 52 - 25 - 69 - 45 - 15 Please not that separator should automatically inserted.
This is somewhat similar to below gif. enter image description here
Here is an example of how you can register a callback to be called when a key is pressed in an entry widget. You can use this callback to insert a dash automatically when needed.
Here I am using the
bind()method to register keypress events on aTk::Entrywidget, I also use-validatecommandto ensure the user does not type in more than 14 characters: