Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Still trying to figure this out!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Bruski




PostPosted: Wed Jun 11, 2003 10:05 pm   Post subject: Still trying to figure this out!

hello its bruski again, i just need a bit of help with this gui
i want to make a button so when the fields are filled in the person presses calculate total button and the total is calculated. can u plz help me with this...and also with the text i have right now i need some help with that to the total and subtotal would it be possible to display in a textfield?

code:

import GUI

View.Set ("graphics:600;300,nobuttonbar")

var nameTextField, addressTextField, cityTextField, provinceTextField, costTextField, postalTextField, memberTextField : int
var total, tax, cost, subTotal, GST, PST : real
const gst:=0.07
const pst:=0.08
colorback(yellow)

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 (postalTextField, 0, 0)
    GUI.SetActive (postalTextField)
end CityEntered

procedure PostalEntered (text : string)
    GUI.SetSelection (costTextField, 0, 0)
    GUI.SetActive (costTextField)
end PostalEntered

procedure ProvinceEntered (text : string)
    GUI.SetSelection (costTextField, 0, 0)
    GUI.SetActive (costTextField)
end ProvinceEntered

procedure CostCD (text : string)
locatexy(390,160)
put "Total $"
total:= strreal(text)+strreal(text)*(pst+gst)
locatexy(450,160)
colorback(white)
put total:4:2
locatexy(530,160)
colorback(yellow)
put " "


locatexy(354,265)
put "Sub Total $"
subTotal:= strreal(text)
locatexy(450,265)
colorback(white)
put subTotal:4:2
locatexy(530,265)
colorback(yellow)
put ""

locatexy(390,220)
put "GST $"
GST:= strreal(text)+strreal(text)*gst-strreal(text)
locatexy(450,220)
colorback(white)
put GST:4:2
locatexy(530,220)
colorback(yellow)
put " "


locatexy(354,190)
put "PST $"
PST:= strreal(text)+strreal(text)*pst-strreal(text)
locatexy(450,190)
colorback(white)
put PST:4:2
locatexy(530,190)
colorback(yellow)
put ""


end CostCD

procedure Button2Pressed

end Button2Pressed



GUI.SetBackgroundColor (yellow)
%declare fields & labels
nameTextField := GUI.CreateTextFieldFull (75, 250, 200, "",
    NameEntered, GUI.INDENT, 0, 0)
var nameLabel := GUI.CreateLabelFull (65, 250, "Name:", 0, 0,
    GUI.RIGHT, 0)

addressTextField := GUI.CreateTextFieldFull (75, 220, 200, "",
    AddressEntered, GUI.INDENT, 0, 0)
var addressLabel := GUI.CreateLabelFull (65, 220, "Address:", 0, 0,
    GUI.RIGHT, 0)

cityTextField := GUI.CreateTextFieldFull (75, 190, 200, "",
    CityEntered, GUI.INDENT, 0, 0)
var cityLabel := GUI.CreateLabelFull (65, 190, "City:", 0, 0,
    GUI.RIGHT, 0)

provinceTextField := GUI.CreateTextFieldFull (75, 160, 55, "",
    ProvinceEntered, GUI.INDENT, 0, 0)
var provinceLabel := GUI.CreateLabelFull (65, 160, "Province:", 0, 0,
    GUI.RIGHT, 0)
   
postalTextField := GUI.CreateTextFieldFull (220, 160, 55, "",
    PostalEntered, GUI.INDENT, 0, 0)
var postalLabel := GUI.CreateLabelFull (210, 160, "Postal Code:", 0, 0,
    GUI.RIGHT, 0)

costTextField := GUI.CreateTextFieldFull (75, 130, 55, "",
    CostCD, GUI.INDENT, 0, 0)
var costLabel := GUI.CreateLabelFull (65, 130, "CD Cost:", 0, 0,
    GUI.RIGHT, 0)

var b1 := GUI.CreateButton (10, 10, 100, "Button 1", Button2Pressed)
var quitBtn : int := GUI.CreateButton (200, 10, 0, "Quit", GUI.Quit)
loop
    exit when GUI.ProcessEvent
end loop


thx again Laughing
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: