Page 1 of 1

Immediate change to box contents based on input to other tex

Posted: Mon Feb 10, 2014 7:21 pm
by R1Johnny
Good evening.

Please consider 2 textboxes. One is for integer #1, the second is for integer #2.
Based on the contents of these boxes I'd like the "Total" textbox to be computed immediately when the focus changes away from either the integer 1 or integer 2 textboxes.

Example: A user types "3" in input box 1, and types "2" in input box 2.
I'd like the result to be displayed immediately when the user clicks anywhere else on the screen.

What type of box should "Total" be and how would I go about scripting the response that I desire?

Thanks very much.
Regards,
John

Re: Immediate change to box contents based on input to other

Posted: Mon Feb 10, 2014 7:38 pm
by R1Johnny
Upon further reflection, I'd like to ask the question a bit differently.
A user inputs "3" to integer textbox #1. A "3" appears immediately in the "Total" box

The user then inputs "2" into integer textbox #2. As soon as the 2 is input, the value of "Total" changes automatically and immediately to 5.

Extending the example, the user then changes integer textbox #1 by entering "1". The value of the "Total" box changes immediately to 3.

Can you please advise on the type of box for "Total" and the method to invoke the immediate update?

Thanks again.

John

Re: Immediate change to box contents based on input to other

Posted: Mon Feb 10, 2014 8:43 pm
by jvierra
You have to write the code to do that. It requires using arithmetic and adding the values. There is no magic method. Just simple coding and assignment.

2 + 1 = 3

$tb3.Text = [int]$tb1.Text + [int]$tb2.Txt

Start here: http://www.sapien.com/blog/topics/user- ... istrators/

Re: Immediate change to box contents based on input to other

Posted: Tue Feb 11, 2014 3:34 pm
by R1Johnny
Good afternoon,
Understood about the math. That's a given.
I was just wondering how to make the changes immediate when the user inputs the integers.
How do I make $tp3.text update immediately without any button clicks?

Thanks again.

John

Re: Immediate change to box contents based on input to other

Posted: Tue Feb 11, 2014 4:14 pm
by jvierra
Pick and event and use it to set the other boxes.

Read the blog on GUI design for administrators to learn how Forms work.

http://www.sapien.com/blog/topics/user- ... istrators/