Return in entry fields

Charles Szasz cszasz at
Fri Dec 8 15:55:10 EST 2006

I have the following script in fields where the user enter data. The  
script allows only two digits to be entered into fields. This works  
great with the user using the Tab key to move to the next field after  
data is entered. However, if the user enters two numbers and presses  
the Return key, the numbers are pushed aside in the entry field and  
you cannot see the numbers and the enter does not advance to the next  

How can I allow entry of two numbers using the Tab and Return key?

ON keyDown whichKey
   IF whichKey is a number THEN
     IF the selection is not empty THEN delete the selection
     IF the length of me < 2 THEN
       pass keyDown
       beep -- or something to indicate longer number is prohibited
     END IF
END keyDown

Charles Szasz
cszasz at

More information about the Use-livecode mailing list