Here's a rough start.
Add 2 class variables to the form (properties).
Call them, say, 'pos' and 'val'
where pos with point to the current '0' in '0000' and
val will be the current value of the text box.
In the Textbox When Method, put the following code:
Store "0000" to This.Value,Thisform.val
Thisform.pos = 4
In the Textbox GotFocus Event put ...
Set cursor off
In the Textbox LostFocus Event put ...
Set cursor on
In the Textbox InteractiveChange Event put ...
This.Value = Thisform.val
In the Textbox KeyPress Event put ...
do case
case 48<=nKeyCode and nKeyCode<=57 and Thisform.pos > 0
Thisform.val = ;
stuff(Thisform.val,Thisform.pos,1,chr(nKeyCode))
Thisform.pos = Thisform.pos - 1
case nKeyCode = 4 and Thisform.pos < 4
Thisform.pos = Thisform.pos + 1
Thisform.val = ;
stuff(Thisform.val,Thisform.pos,1,"0"

This.value = Thisform.val
endcase