So i’ve got 3 textfields (A, B, C) where the user can only enter numbers as the keyboard is a number pad.
I’ve got a check (which a user here sorted out for me) that brings up an error if the user tries to enter more than 100 in each box.
I need a method that looks at the number entered in the textfield and then looks at the total of the 3 and then adjusts the others accordingly.
An example would be say i typed the following:
Example 1
A = 50
I would expect B to fill in with the remaining 50
Example 2
A =40 B=50 C=10
I then change A to 60. The total is now 120.
I would like it to look at B, then take 20 away so I have the following.
A=60 B=30 C=10
I’ve seen scenarios where a user has 2 textfields that he wants to total 100 but I have not seen threads that ask for 3.
Thanks
Let’s say you have three fields. This is pseudocode. Attach this delegate function to all 3 text areas.
If you use integer division, then you will have a rounding problem. Hint: if it’s odd, you can add one to one of the fields.
Make sure you write tests. I’ve not tried any of this, but it should work.