using multiply command

Visit here to inform or invite LiveCode users to user groups, meetings, conventions or other gatherings. Events must be related to LiveCode.

Moderators: FourthWorld, Klaus, robinmiller

Post Reply
trags3
Posts: 418
Joined: Wed Apr 09, 2014 1:58 am
Location: Las Vegas, NV

using multiply command

Post by trags3 » Wed Apr 09, 2014 4:08 pm

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

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: using multiply command

Post by dave.kilroy » Wed Apr 09, 2014 5:16 pm

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)
"...this is not the code you are looking for..."

trags3
Posts: 418
Joined: Wed Apr 09, 2014 1:58 am
Location: Las Vegas, NV

Re: using multiply command

Post by trags3 » Wed Apr 09, 2014 6:54 pm

Dave, Thanks, I got it all working very well. I appreciate the help.
Tom

Post Reply

Return to “User Groups and Events”