Math app replacing values in text attribute instead adding digits
baljettim
Member Posts: 3
in Tech Support
Im trying to make a math app that displays a problem and then you type in the solution using only numbers on a calculator like number pad. The issue im having is that the numbers are not being saved in the text attribute when i hit multiple number pad buttons. when i click on "1" then "2" im getting a "1" on the display then it replaces the one with a "2". but i want a "12".
im sure there is a simple solution to this, its just alluding me right now.
any help would be great
Comments
You need to concatenate the values.
Instead of doing something like this:
Do something like this, using .. to add the new value to the end rather than replacing it:
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Doing this the way @Armelline suggests is a great way to concatenate numerals.
Another way is to multiply the number by 10 and then add the new input value. For example, if you were to hit the "2" button it would look something like this:
Change Attribute: [self.Number] To: [(self.Number *10)+2]
thanks guys, so simple and so functional, really appreciate it :)