Quick Total Form
Posted: Sat Jan 29, 2011 7:36 pm
Hello all,
This is my first shot at livecode. I cant seem to get anything in this code to work
other then one beep. The doTotal function is not found and does not run, I assume.
I have pasted in the scripts in use as well as attached the livecode stack. Any help
would be greatly appreciated.
BB
// This script is in a button called optTotal
on mouseup
beep
call doTotal
end mouseup
// this script is in the main stack called qwkForm
global gVarDesc
global gVarSubTotal
global gVarTotal
global gVarShipping
function doTotal
if optPC = "New" then
put "Big New PC with " into gVarDesc
gVarSubTotal = 100
gVarShipping = 50
else
put "Small Used PC with " into gVarDesc
gVarSubTotal = 50
gVarShipping = 35
end if
if optHD = "Big" then
put gVarDesc + "Big Hard Drive" into
gVarSubtotal = gVarSubTotal + 75
gVarShipping = gVarShipping + 10
else
put gVarDesc + "Small Hard Drive" into
gVarSubtotal = gVarSubTotal + 45
gVarShipping = gVarShipping + 5
end if
put gVarDesc into fldDesc
put gVarSubtotal into fldSubTotal
put gVarShipping into fldShipping
put gVarSubtotal + gVarShipping into fldTotal
end doTotal
This is my first shot at livecode. I cant seem to get anything in this code to work
other then one beep. The doTotal function is not found and does not run, I assume.
I have pasted in the scripts in use as well as attached the livecode stack. Any help
would be greatly appreciated.
BB
// This script is in a button called optTotal
on mouseup
beep
call doTotal
end mouseup
// this script is in the main stack called qwkForm
global gVarDesc
global gVarSubTotal
global gVarTotal
global gVarShipping
function doTotal
if optPC = "New" then
put "Big New PC with " into gVarDesc
gVarSubTotal = 100
gVarShipping = 50
else
put "Small Used PC with " into gVarDesc
gVarSubTotal = 50
gVarShipping = 35
end if
if optHD = "Big" then
put gVarDesc + "Big Hard Drive" into
gVarSubtotal = gVarSubTotal + 75
gVarShipping = gVarShipping + 10
else
put gVarDesc + "Small Hard Drive" into
gVarSubtotal = gVarSubTotal + 45
gVarShipping = gVarShipping + 5
end if
put gVarDesc into fldDesc
put gVarSubtotal into fldSubTotal
put gVarShipping into fldShipping
put gVarSubtotal + gVarShipping into fldTotal
end doTotal