How to change Text in button on random clicks Thunkable Makeroid AppInventor

How to change Text in button on random clicks, so many thunkers do know how to command this and uses other methods which increase blocks quantity and makes app crashes.
Now let's see how to do this step by step.

(Note: If you directly want Blocks Image or Aia file scroll last of this post.)

Step1:
Sign in to your Thunkable Platforms

Step2:
Add a button component where you want to place it and change the text on random clicks.

Step3:

Now at button text set the text to something that will appear default when the user opens the screen or app.
(here we are using three words = Apple, Banana, Carrot)



Here we used Apple text as a default, so when the user opens the screen the text in button will appear Apple and when random click the will change to other words.

Step4:

Now go to blocks page.

Step5:
Now search and Drag "when button.click" block to the command page.



Step6:
Now Thunk or attach "if-then" block to "When Button.click".


Step7:
Now thunk "Equal block" from logic to "If block".

Step8:
Now thunk "Button.text" block to "Equal Block".



Step9:

Now thunk "Empty Text String" to another side of "Equal block" and Enter the First or Default Word.

Step10:
Now Thunk "set button.Text" block to "If-Then" block and Place or thunk empty string to "set button.text" and enter the 2nd word.

From this arrangement When a user clicks the button then text in button will change from Apple to Banana. Let's do another command so when the user clicked it again then Text in button will change from Banana to Carrot.

Step11:
Now press the Setting icon in "if-then" Block and select "Else if" block now drag and thunk it to right If block.
Step12:
Now copy the Equal and Set button.text blocks and thunk them to below blocks and change the text in text string block. As below Image shows.
From this arrangement we arranged that When user clicks the button 2nd time or clicked when text in button is Banana, then text in button will change from Banana to Carrot. Let's do another command so when user clicked it again then Text in button will change from Carrot to Apple. So that it will again goes apple goes so on (Loops again and again).

Step13:
Now do the same process as step11 we did.
Step14:
It is as same as Step12 but now change text Banana to carrot and carrot to Apple.

Now copy the Equal and Set button.text blocks and thunk them to below blocks and change the text in text string block. As below Image shows.
Now that's it the process will go on again and again on random clicks.

This is the full blocks Image to Change Text in button on Random Clicks.
Aia File: ๐Ÿ‘‰Click Here๐Ÿ‘ˆ

Happy tHunking๐Ÿ˜Ž๐Ÿ˜Ž

Post a Comment

0 Comments