Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Text input like a formular

Author
Message
Lindwedler
7
Years of Service
User Offline
Joined: 14th Jun 2017
Location: Germany, Lindwedel in Lower Saxony
Posted: 2nd Oct 2017 11:17 Edited at: 2nd Oct 2017 11:18
How can i create a Formular for Text-Input. I know the "StartTextInput" command.
But if i have something like a formular where the player should make more then 1 entry (Adress and so on), i donĀ“t know how to do it with this Input-Command.
Thanks for ideas, code examples and help!
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 2nd Oct 2017 12:47
What are you after exactly? Multiple text boxes for an address or are you after regular expressions to make sure addresses given in one text box meet a particular format i.e. correct length POSTCODE/ZIP CODE etc.?
Lindwedler
7
Years of Service
User Offline
Joined: 14th Jun 2017
Location: Germany, Lindwedel in Lower Saxony
Posted: 2nd Oct 2017 14:59 Edited at: 2nd Oct 2017 15:05
Multiple Text-Boxes would be good. For my program, the maximal 4 players should enter the name (string) and number of points (integer, positive and negativ numbers possible) they have. the program calculate then the result (in cent). its a calculation program for a (skat) card game.
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 2nd Oct 2017 15:39 Edited at: 2nd Oct 2017 15:39
If you want multiple ones then used edit boxes instead of InputText

Give each textbox an id i.e.

textbox1 = CreateEditBox()
textbox2 = CreateEditBox()
textbox3 = CreateEditBox()

If you want to get text from either textbox once they've pressed a button/sprite like a submit button for example then use: GetEditBoxText i.e.

textbox1Value$ = GetEditBoxText(textbox1)

You can find out if a particular textbox has focus i.e. the user is typing something in it, or at least clicked in it with GetEditBoxHasFocus(textbox1)

Check out all of the commands here in the Edit Box section of the page: https://www.appgamekit.com/documentation/Reference/Input.htm

I'm not a fan of them myself but that's what you want if you want more than one
Lindwedler
7
Years of Service
User Offline
Joined: 14th Jun 2017
Location: Germany, Lindwedel in Lower Saxony
Posted: 2nd Oct 2017 19:12 Edited at: 2nd Oct 2017 19:16
Perfect! This is what i need. Thank you!

I never would take a look at "CreatEditBox"-Command, because i thought it would be like a big textarea and nothing for small text input. Thanks a lot from a lonely place in the woods of the heidekreis in germany
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 2nd Oct 2017 20:42 Edited at: 2nd Oct 2017 20:46
You're welcome and yes you can do single line text boxes with CreateEditBox. You can also do multiple line ones too if needed. Unfortunately you can't select text, and you can't copy and paste text into the edit tbox, not without using a plugin and I've only seen one on the forum for Windows only. You also can't hold down the delete button to delete multiple characters.

When a edit box is in focus it doesn't move into view so if you're not careful you could end up having the keyboard on the device cover the edit box so you're not able to see what you're typing. You need to start using things like SetViewOffset to move the camera down so that the edit box is higher up on the screen and then move the camera back up when the user leaves the edit box. Given time I could probably produce a larger list of problems I've found with edit boxes.

You might want to keep all of that in mind.

Login to post a reply

Server time is: 2024-11-22 20:47:36
Your offset time is: 2024-11-22 20:47:36