To do this, click 'Add Event' or right-click on empty space > Add Event; then double click on 'System' and then 'Compare Two Values'.
NOTE: We use 'Greater than or equal to' instead of equals to prevent a bypass of typing multiple characters rapidly.
Then enter the following:
Hint:
First value: len(TextBox.Text)
Comparison: >= Greater than or equal to
Second value: 11
Change 'TextBox' to the name of your object and '11' to your character limit.
Now click on 'Add action', then double-click on your textbox > Set text and type
The 'left' expression simply returns the first amount specified (e.g. 10) of characters in a text string.
This means that trying to type 'Insert text here' will only allow 'Insert tex' to show.
NOTE: Spaces count towards the character limit.
Example:
Display a message when limit is reached
Create a text object and set the text to 'Max 10 Characters' then set visibility to invisible in the properties. You can optionally add the fade behaviour and set properties to something like:
Wait time: 1
Fade out time: 1
Add actions(to previous condition):
Text > Set Visible
Text> Fade: restart fade
Other Uses:
Display a 'Press Enter to continue' when limit reached or a button.
Download the CAPX to see a demonstration.
Enjoy!