Page 1 of 1

using multiply command

Posted: Wed Apr 09, 2014 4:08 pm
by trags3
I have 2 text entry fields on one card and i need to multiply them and display the result.
I need to have the result put into another field on the same card.
Obviously I am brand new to LiveCode (thursday night).
Tom

Re: using multiply command

Posted: Wed Apr 09, 2014 5:16 pm
by dave.kilroy
Hi trags3 and welcome to the forum

Assuming you have a card with three fields and button, put the following code into the button's script

Code: Select all

on mouseUp
  put field 1 into tNumber1
  put field 2 into tNumber2
  put tNumber1 * tNumber2 into tResult
  put tResult into field 3
end mouseUp
Then populate fields 1 and 2 with the numbers you want to multiply and click the button

NB: the above is about as simple as it gets and there is no error checking (for example the script relies on there being valid numbers in fields 1 and 2)

Re: using multiply command

Posted: Wed Apr 09, 2014 6:54 pm
by trags3
Dave, Thanks, I got it all working very well. I appreciate the help.
Tom