HOWTO: Capitalise letters, and remove spaces in textbox as you type

399 views
Skip to first unread message

TimAI2

unread,
Mar 25, 2018, 7:29:15 AM3/25/18
to mitappinv...@googlegroups.com
Little routine to capitalise letters as you type in a textbox, along with removal of spaces if typed 


Uses Taifun's Textbox extension


Capitalise.aia

Taifun

unread,
Mar 25, 2018, 12:25:42 PM3/25/18
to MIT App Inventor Forum
alternatively you might want to look into the textbox extension, which offers an AfterTextChanged event, so you do not need a clock anymore...

Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

TimAI2

unread,
Mar 25, 2018, 1:36:10 PM3/25/18
to MIT App Inventor Forum
I didn't spot that!

Thanks Taifun

Abraham Getzler

unread,
Mar 25, 2018, 2:06:29 PM3/25/18
to MIT App Inventor Forum
If you want to avoid extensions, you can use a button or label to hold
the cleaned text, and a Clock to sweep cleaned data frequently from
a TextBox.  In this example, I use a button to show the cleaned text,
to offer backspace deletion and focus transfer to the real text input box.
ABG


Capture.PNG
Designer.PNG
allCAPS.aia
blocks.png

TimAI2

unread,
Mar 26, 2018, 11:49:51 AM3/26/18
to MIT App Inventor Forum
Tried with the AfterTextChanged

Testing in companion I get this error:


on entering a single letter there is a delay of a second or two, then up pops message, but routine inside the AfterTextChanged event does complete. Same problem for next letter, then app killed and causes emulator reboot !!


Blocks




Taifun

unread,
Mar 26, 2018, 1:25:11 PM3/26/18
to MIT App Inventor Forum
you created an endless loop...
to avoid that, you might want to use a boolean variable while setting the text inside that event
and before setting the text, check that boolean variable

TimAI2

unread,
Mar 26, 2018, 5:19:50 PM3/26/18
to MIT App Inventor Forum
Ahhh, one of ABG's ouroborous' ;)

These blocks seem to resolve it


Reply all
Reply to author
Forward
0 new messages