How do I add the textbox values I input into the box?

Get help using Construct 2

Post » Tue Oct 13, 2015 2:03 am

Hello all. I was wondering, how do you add (and only add) the textbox values you input into the box, and have the answer show up as the text beside the textbox? Whatever you type into the textbox should keep adding on to the text/number beside it.
Last edited by guannstar on Tue Oct 13, 2015 4:52 am, edited 2 times in total.
B
28
S
5
G
1
Posts: 594
Reputation: 3,286

Post » Tue Oct 13, 2015 3:35 am

use on "ON input box changed" rather than pulsing it every tick.

Also, use Append, to glue stuff to the end.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Tue Oct 13, 2015 4:08 am

I did what you said, but that just duplicates the number in the textbox (turns 11 into 1111), it doesn't add the values together (like 11 + 11 = 22).

https://dl.dropboxusercontent.com/u/541 ... mple2.capx
B
28
S
5
G
1
Posts: 594
Reputation: 3,286

Post » Tue Oct 13, 2015 10:23 am

Create a global variable

keyboard on enter or on button clicked
> system add : int(NumberAmount.Text) to global variable
> NumberAmountText set text : global variable
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Oct 13, 2015 3:11 pm

Oh! you wanted the sum, not to add text to the string. Sorry about that.

My English is not so great, I dont live around here.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Tue Oct 13, 2015 5:33 pm

LittleStain wrote:Create a global variable

keyboard on enter or on button clicked
> system add : int(NumberAmount.Text) to global variable
> NumberAmountText set text : global variable


It works! Thanks @LittleStain. This is exactly what I was looking for.
B
28
S
5
G
1
Posts: 594
Reputation: 3,286


Return to How do I....?

Who is online

Users browsing this forum: jasontoups, raptor0555 and 1 guest