Hi everyone
I have searched the forum for a solution to the problem I have and the only similar topic I have found is Mask for cell value but it doesn’t solve my problem
I have several text columns but one and only one of them must have an input mask in this format ‘00.00000.000.00’ (with zero fill; see the examples)
Only allowed characters in this column must be numbers, space and dot; all other characters should be ignored when typing
The goal is that as the user writes, he sees the text in the cell formatted in real-time
Here are two examples (the left side is the sequence of keys typed on the keyboard, the right side is what user should see in the cell while types; note that space and dot key are equivalent)
example 1:
2 2
2DOT 02.
2DOT1 02.1
2DOT12 02.12
2DOT123 02.123
2DOT1234 02.1234
2DOT12345 02.12345
2DOT123456 02.12345.6
2DOT1234567 02.12345.67
2DOT1234567DOT 02.12345.067.
2DOT1234567DOT8 02.12345.067.8
2DOT1234567DOT89 02.12345.067.89
2DOT1234567DOT89ENTER 02.12345.067.89
example 2:
2 2
22 22
221 22.1
2213 22.13
22134 22.134
22134SPACE 22.00134.
22134SPACE2 22.00134.2
22134SPACE2SPACE 22.00134.002.
22134SPACE2SPACE9 22.00134.002.9
22134SPACE2SPACE9ENTER 22.00134.002.09
I’ve read about how I could use the beforeKeyDown event, a custom render (but it seems that formatting only happens on cell exit), RegEx etc… but i have no idea how i can implement the logic
Any tip?
Thanks in advance to anyone who can contribute with an idea/solution