TEXT
Limit the number of characters in an Edit Field
I encountered this problem but solved it fairly easily. Use ON EDIT fn filterKeys to check the number of characters in the field each time a key is pressed:
LOCAL FN filterKeys
key$ = TEKEY$
LONG IF LEN(EDIT$(efID)) =< maxChars
TEKEY$ = key$ 'Ok send the keystrokes through
XELSE
BEEP 'Too many chars in edit field!
END IF
END FN
ON EDIT fn filterKeys
|