I am using a textfield to enter data and am using a Pushbutton to calculate the result with the following code.
dim ratio as double
ratio = val(txtmm.text) * 0.0393700787
txtanswer.text = Format(ratio,“0.00000”) + " Inches"
txtcalculation.text = “1 mm = 0.03937 inches”
Everything work fine.
What I am wondering is there a way for the answer to be calculated as the data is entered without having to click on the pushbutton.
Thanks Shane
[quote=105635:@Shane Rampling]I am using a textfield to enter data and am using a Pushbutton to calculate the result with the following code.
dim ratio as double
ratio = val(txtmm.text) * 0.0393700787
txtanswer.text = Format(ratio,“0.00000”) + " Inches"
txtcalculation.text = “1 mm = 0.03937 inches”
Everything work fine.
What I am wondering is there a way for the answer to be calculated as the data is entered without having to click on the pushbutton.
Thanks Shane[/quote]
Sure, use the TextChange event of the TextField. http://documentation.xojo.com/index.php/TextField.TextChange
TextChanged event should be what you are looking for.
Thanks for the replies, I am only a beginer at programing and not sure how to implement some of these things, how would I go about it.
Thanks Shane.
Shane,
Single click on the name of the textfield in the navigator area (left hand side), and then click on Insert > EventHandler from the top menubar.
Then add the TextChanged event handler.
Then put your code in there.
Hope that helps.
Thanks Richard, exactly what I was after.