
-----------------------------------
Bruski
Fri Jun 13, 2003 12:46 pm

Text Box Question!!!!
-----------------------------------
Hello i need some serious help most of my gui is done but i need some help. I want to put a check box so that ppl get to choose weather or not they have a membership and another if they want one...my problem is that i dont know how to make it that when they click buy membership, the discount is shown and the amount of the membership is put in the membership fee when you press calc...

for example...

if they have membership...put automatic discount
if they dont have membership...they go to the next two boxes and are asked if they want to purchase one, if no then the calculation is processed without discount or mem fee but if yes then a mem fee is added to the total and a discount is also taken away...plz plz plz help this is due tuesday and its worth like 20% of my mark...thx again heres the code...


import GUI 

View.Set ("graphics:400;300,nobuttonbar") 

var nameTextField, addressTextField, cityTextField, provinceTextField, costTextField : int 
var total, tax, cost, subTotal, GSTtot, PSTtot, discount, membership : real 
var tot := "" 
var sub := "" 
var gst := "" 
var pst := "" 
var dis := ""
var mem := ""
const gstTax:=0.07 
const pstTax:=0.08 
var draw : boolean := false 
tax := 0.15 
colorback (black) 

procedure NameEntered (text : string) 
   GUI.SetSelection (addressTextField, 0, 0) 
   GUI.SetActive (addressTextField) 
end NameEntered 

procedure AddressEntered (text : string) 
   GUI.SetSelection (cityTextField, 0, 0) 
   GUI.SetActive (cityTextField) 
end AddressEntered 

procedure CityEntered (text : string) 
   GUI.SetSelection (provinceTextField, 0, 0) 
   GUI.SetActive (provinceTextField) 
end CityEntered 

procedure ProvinceEntered (text : string) 
   GUI.SetSelection (costTextField, 0, 0) 
   GUI.SetActive (costTextField) 
end ProvinceEntered 

procedure CostCD (text : string)
    
   total := strreal (text) + strreal (text) * tax 
   tot := realstr (total, 10) 
   subTotal :=strreal (text) 
   sub := realstr (subTotal, 10) 
   GSTtot :=strreal (text) * gstTax 
   gst := realstr (GSTtot, 10) 
   PSTtot :=strreal (text) * pstTax 
   pst := realstr (PSTtot, 10)
   discount:=strreal (text) + strreal (text) *1.15
   dis:=realstr (discount, 10) 
   membership:=strreal (text) + strreal (text) *1.15
   mem:=realstr (membership, 10) 
end CostCD 

procedure emptyf (text : string) 
   tot:= "" 
   sub:= "" 
   gst:= "" 
   pst:= "" 
   dis:= ""
   mem:= ""
end emptyf 

procedure caculate () 
   draw := true 
end caculate 

GUI.SetBackgroundColor (yellow) 
%declare fields & labels 
nameTextField := GUI.CreateTextFieldFull (65, 250, 100, "", NameEntered, GUI.INDENT, 0, 0) 
var nameLabel := GUI.CreateLabelFull (55, 250, "Name:", 0, 0, GUI.RIGHT, 0) 

addressTextField := GUI.CreateTextFieldFull (65, 220, 100, "", AddressEntered, GUI.INDENT, 0, 0) 
var addressLabel := GUI.CreateLabelFull (55, 220, "Address:", 0, 0, GUI.RIGHT, 0) 

cityTextField := GUI.CreateTextFieldFull (65, 190, 100, "", CityEntered, GUI.INDENT, 0, 0) 
var cityLabel := GUI.CreateLabelFull (55, 190, "City:", 0, 0, GUI.RIGHT, 0) 

provinceTextField := GUI.CreateTextFieldFull (65, 160, 100, "", ProvinceEntered, GUI.INDENT, 0, 0) 
var provinceLabel := GUI.CreateLabelFull (55, 160, "Province:", 0, 0, GUI.RIGHT, 0) 

var taxtf := GUI.CreateTextFieldFull (235, 130, 155, "", emptyf, GUI.INDENT, 0, 0) 
var subTotalf := GUI.CreateTextFieldFull (235, 250, 155, "", emptyf, GUI.INDENT, 0, 0) 
var gstf := GUI.CreateTextFieldFull (235, 160, 55, "", emptyf, GUI.INDENT, 0, 0) 
var pstf := GUI.CreateTextFieldFull (335, 160, 55, "", emptyf, GUI.INDENT, 0, 0)
var disf := GUI.CreateTextFieldFull (235, 190, 155, "", emptyf, GUI.INDENT, 0, 0)
var memf := GUI.CreateTextFieldFull (235, 220, 155, "", emptyf, GUI.INDENT, 0, 0) 


costTextField := GUI.CreateTextFieldFull (65, 130, 100, "", CostCD, GUI.INDENT, 0, 0) 
var gtax := GUI.CreateLabelFull (225, 130, "Total:", 0, 0,GUI.RIGHT, 0) 
var ggst := GUI.CreateLabelFull (225, 160, "GST:", 0, 0,GUI.RIGHT, 0) 
var gpst := GUI.CreateLabelFull (325, 160, "PST:", 0, 0,GUI.RIGHT, 0) 
var gsub := GUI.CreateLabelFull (225, 250, "Subtotal:", 0, 0,GUI.RIGHT, 0) 
var gdis := GUI.CreateLabelFull (225, 190, "Discount:", 0, 0,GUI.RIGHT, 0)
var gmem := GUI.CreateLabelFull (225, 220, "Mem Fee:", 0, 0,GUI.RIGHT, 0)

var costLabel := GUI.CreateLabelFull (55, 130, "CD Cost:", 0, 0, GUI.RIGHT, 0) 
var quitBtn : int := GUI.CreateButton (100, 80, 0, "Quit", GUI.Quit) 

var calcb : int := GUI.CreateButton (160, 80, 0, "Calculate", caculate) 
var clearScrn : int := GUI.CreateButton (245, 80, 0, "Clear Screen", caculate)
loop 
   if draw then 
       GUI.SetText (taxtf, tot) 
       GUI.SetText (subTotalf, sub) 
       GUI.SetText (gstf, gst) 
       GUI.SetText (pstf, pst) 
       GUI.SetText (disf, dis)
       GUI.SetText (memf, mem)
       draw := false 
   end if 
   exit when GUI.ProcessEvent 
end loop 


thanks yet again alex :cry:
