How to Limit Text in Text Box Thunkable Makeroid AppInventor

In App making we need know each and every small things in order to provide a better experience for the users.Some times we use Text boxes in app design depend upon the app Type and use. In some cases we also need to restrict the characters of letters. For example if you are making a Quick chat App to make users chat each other in Quick way like the following.

Im Busy!
Call me Later.
What's Up!
Like these quick word so that user can makes his most repeated words in to a Quick chat.

But what does a quick chat means?
A quick means a quick word that tiny in length.
But what if users types more text and saves as a Quick chat like 500 words. It will cause some problems like app crashing or takes so much time to load the message, so to prevent it we need to limit the characters in order to protect the users creating long sentence as a Quick Chat.

Let's Take this Quick Chat as a Example.

So let's Get started in Steps
For this as we know the point here is about to restrict the number of characters in TextBox so just design your app and Also include Notifier with TextBox to notify the user to use limited characters.
And also add a Button Component to save that words as a Quick Chat.

Now go to Blocks Page And drag the Button Component as it is key component to save the Quick Chat In this case. And attach If Then Block to it as shown below.

Now attach an Equal Block from maths and change the Equal symbol to Less than or Equal Symbol (⋧) To It as shown below.

Now attach Length Block to Left of the Math block from Text Blocks as shown below.

Now Attach the TexBox.Text block to Length Block as shown below.

Now attach Number Block From Math to right the Math block as shown below.

Now Add number that how Many characters that user can enter as a Quick chat.
Here we used 255 characters as a limit to quick chat so that user cannot Save the Words if the chat is more than 255 characters.

Here We can give Commands in Then to save the Quick Chat here we used TinyDB to save the words so that we can Get the sentence or words when ever we want and Blocks arrangement will be like this as shown below.

Here the process will take When the characters are not exceeded, what if Characters are exceeded so we need to warn the user about this, so for that tap the setting icon in If Then block and Drag and attach the Else string to the other side block as shown below.
Now lets warn the user using Notifier, so attach the call Notifier Show Notice Block to Else Block as shown below.

Now attach the Empty Text String to Notice block and text a notice to user like
Quick Chat must not Exceed 255 characters.

That's It The message will be shown to user when user exceeds the characters.

Happy tHunking😎😎

Post a comment