Label cursor back to front


How can I ensure that the cursor is returned to the beginning when clearing a label?
see example:

when i fll in a wrong code the label is reset again (empty) but the cursor stays in place. how can i make the cursor go back to the front.

The Keyboard has some methods to setText() and clearText(). If you use those the cursor behaves.