KeyPad variable

Hi, I’m trying to develop a keypad as above, but I cannot save into a variable the value of typing buttons. Such as I need to save the old value plus the new one about the button that I have clicked. How Can I control a button by plugin code?

Waiting for news. Best regards.

Maybe you will find here the answer: