Limiting the number of characters during data entry
There are times when you might want to limit the number of characters a user can enter into a field. This lesson will show you how to control this.
When the user types into the field the keyDown handler checks to see if the field already contains the maximum number of character allowed. If the field already contains the maximum number of characters LiveCode beeps and doesn't pass the keyDown message which causes the key press to be lost.
The keyword me refers to the object whose script contains the handler that is executing. In this case me refers to the field because the keyDown handler is in the field's script. When a field is referenced in this way LiveCode returns the contents of the field, the length of that content is the number of characters it contains. So the expression
the length of me
is the number of characters in the field.