The keys on the MD-HMI are already decoded and mapped to the digital inputs #17 to #24 for T100MD888, T100MD1616,F1616-BA or to DI #25 to #32 for T100MD2424, F2424. It makes it flexible since the keys can be used by the program in any way.
To use the keypad to enter numerical data into the PLC, there are already sample programs in the folder:
TRiLOGI\TL6\usr\samples\HMI
You can simply incorporate the custom function into your own program and use the result for entering data into the PLC.