Can a text box be created by clicking a button?

Hey, I'm making an app that reads out punching and kicking combinations for boxers called Voice Box. I want to make it so when you press a button, a textbox where you can type the moves you use (uppercut, knee, straight kick, etc) so that VoiceBox can randomly create combinations (example, one-two kick). I looked around and couldn't find a way to create a new text box by simply clicking a button. Please help and please don't copy this app idea.

Welcome Matthew.

Not possible using only Blocks. Instead you can:

  • Place a TextBox on the Designer
  • set TextBox.Visible to false
  • when you want to see/use the TextBox, set TextBox.Visible to true in a Button.Click handler.
  • you can 'hide' it again using set TextBox.Visible to false when your app is finished with it.

You could use dynamic components extension by @yusufcihan

2 Likes

I'll give it a go

1 Like

Well then I would need more than the person can ever put in right? That can work

Not necessarily Matthew. You can use one TextBox with multiple purposes. You can set up how it is used by using If..then statements. Programming Your App to Make Decisions explains how to use the If..then; exactly what you do depends on your app's existing code.

Hmm... can i use it with multiple purposes at the same time?

Sorry, I do not understand. It depends on how you code.
If uppercut then ... else if knee then ... random select one-two kick)

You could use a Spinner to select the commands without having to type perhaps.

Like, each text box should have one move (punch, kick, whatever) right? Because it wouldn't work if you put multiple moves in one text box.

The simple answer is right; the advanced answer is code can be written to understand multiple commands typed into a TextBox by parsing the text that is typed.

From you description of how your game works, it might be better to use a Spinner than a TextBox.

1 Like

I'm sorry, but can you edit a slider?

what you can do with a TextBox .

Edit it? The app User can manipulate the text within it or change what he/she types in it.

Sorry, earlier I meant to recommend using a Spinner Spinner

You might want to look at Tim's tutorial 🟧 Spinner Setup

This is what you might wish to do instead of entering info in a TextBox.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.