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

Username:   Password: 
 RegisterRegister   
 Going from "put"s and "get"s to textfiel
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
HelloWorld




PostPosted: Tue Nov 16, 2004 3:11 pm   Post subject: Going from "put"s and "get"s to textfiel

Help, anyone! I will upload it below....

I have worked on this program for a while now, and its pretty good. But I keep trying to use textfields but end up with tons of errors. Right now the program is working fine without textfields. But It would be so much better with textfields. Remember I am a newbe... anyway, help please....

I would upload it, but it says that I am past my 2mb limit tho its only 1.2mb.

Heres the code:
code:

%Josh
%October 23rd-October 26th APROX. 4 hours to create

import GUI
var window : int
window := Window.Open ("graphics:800;550,nobuttonbar")


%----------------------VARIABLES-------------------------------
const gst := 0.07
const pst := 0.08
var n : int     %How many parts; how many loops.
var total : int := 0 %Variable for the total cost
var reply : string (1)     %variable to use with getch command
var name, tel, dat, make, year, mile, license, col, serial, inspect, tobe, need : string %All the variables needed for the questions


var file, view, help : int % The drop down menu's at the top.
var item : array 1 .. 5 of int % The drop down menu items.
var namei : array 1 .. 5 of string (20) :=
    init ("Exit", "Start", "Credits", "Manual", "Version") %Names for items in the drop down menu's, the first name "Exit" is the first items name, and so on..
%--------------------------------------------------------------
forward proc disable %puts it at the top
forward proc hide

procedure start
    disable %Disables specified GUI items
    hide %Hides specified GUI items
    cls

    %----------------------Program info/intro----------------------------
    put ""
    var fontID1 : int := Font.New ("Impact:32:bold")
    Font.Draw ("GDHS", 345, 450, fontID1, black)
    var fontID2 : int := Font.New ("Georgia:24:bold")
    Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
    var fontID3 : int := Font.New ("Georgia:24:bold")
    Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
    var fontID4 : int := Font.New ("Times New Roman:20:bold")
    Font.Draw ("::Receipt Creater:.", 238, 325, fontID4, black)
    drawline (0, 451, 800, 451, black)
    drawline (0, 450, 800, 450, black)

    locate (18, 20)
    put "You will be promt with many questions.  Please answer all of them."
    locate (20, 40)
    put "WHEN READY; PRESS ANY KEY" .. %Waiting for users input of any key
    getch (reply)
    cls
    %--------------------------------------------------------------



    %------------Values for each Variable (input)------------------
    put "Please fill in all the blanks."
    put "If you don't know the answer, simply skip the question."
    put "", skip

    put "Customers Name: " ..
    get name : *

    put "Telephone #: " ..
    get tel : *

    put "Current Date (m/d/y): " ..
    get dat : *

    put "Vehicle Make: " ..
    get make : *

    put "Year: " ..
    get year : *

    put "Mileage: " ..
    get mile : *

    put "License #: " ..
    get license : *

    put "Colour: " ..
    get col : *

    put "Serial #: " ..
    get serial : *

    put "Inspected by: " ..
    get inspect : *

    put "", skip

    put "Work to be done: " ..
    get tobe : *

    put ""

    put "Work needed: " ..
    get need : *

    put "", skip

    put "Press any key to continue to the next set of questions." .. %Waiting for users input of any key
    getch (reply)
    cls
    %--------------------------------------------------------------


    %-----------------The second input-----------------------------
    put "Please fill in all the blanks."
    put "If you don't know the answer, type 'UNKNOWN'."
    put "", skip

    put "How many different parts were purchased? " .. %Depending on the value inputted by the user, the for loop below will loop that many times.
    get n
    %--Vars for counter or within the counter----
    var part, pname : array 1 .. n of string
    var quantity, price, netprice : array 1 .. n of int

    for counter : 1 .. n %Loops for each part.

        put "", skip
        put "PART", counter
        put "What is the part number? " ..
        get part (counter)

        put "How many of this part were purchased? " ..
        get quantity (counter)

        put "What is the parts name? " ..
        get pname (counter) : *

        put "What is the Net price of this part? " ..
        get netprice (counter)

        put "What is the Unit price for this part? " ..
        get price (counter)

    end for

    put "", skip

    put "Press any key to continue." .. %Waiting for users input of any key
    getch (reply)
    cls
    %--------------------------------------------------------------




    %-------------------------OUTPUT.......------------------------
    var stallion : int := Pic.FileNew ("stang.bmp")
    Pic.Draw (stallion, 0, 480, 0)
    var fontID : int := Font.New ("Arial:14:bold")

    locate (4, 35)
    put "GDHS TRANSPORTATION DEPARTMENT" %Title, heading
    put ""
    %Below is the output for all of the inputted data
    locate (6, 25)
    put "Customers Name: ", name
    locate (6, 60)
    put "Telephone #: ", tel

    locate (7, 25)
    put "Date: ", dat
    locate (7, 60)
    put "Vehical Make: ", make

    locate (8, 25)
    put "Year: ", year
    locate (8, 60)
    put "Mileage: ", mile

    locate (9, 25)
    put "License #: ", license
    locate (9, 60)
    put "Colour: ", col

    locate (10, 25)
    put "Serial #: ", serial
    locate (10, 60)
    put "Inspected by: ", inspect


    put ""
    put "Work to be done: ", tobe
    put ""
    put ""

    drawline (0, 346, 800, 346, black) %For over top of work needed.
    drawline (0, 345, 800, 345, black) %Same

    put "Work needed: ", need
    put "", skip

    drawline (0, 290, 650, 290, black)
    %Headings for output table
    locate (18, 1)
    put "Quantity"
    locate (18, 18)
    put "Part#"
    locate (18, 34)
    put "Name"
    locate (18, 50)
    put "Unit Price"
    locate (18, 66)
    put "Net Price"
    %%%



    for counter : 1 .. n
        put quantity (counter), "\t\t", part (counter), " \t\t", pname (counter), "\t\t", price (counter), "\t\t", netprice (counter) %Outputs the inputted data
        total += price (counter) * quantity (counter) %Gives a value to total
    end for


    put "", skip
    locate (21 + n, 66)
    put "Sub Total: $", total %Shows the sub total
    locate (22 + n, 66)
    put "GST: $", gst * total %Shows the GST
    locate (23 + n, 66)
    put "PST: $", pst * total %Shows the PST
    locate (24 + n, 66)
    put "Total: $", total * (gst + pst) + total %price (counter) * quantity (counter) * tax

    put ""
    put "", skip
    put "" : 5, "Paid:__________" : 35, "Customer Signature :____________________"
    %--------------------------------------------------------------
end start

procedure credit
    disable
    hide
    cls

    Pic.ScreenLoad ("bstang.bmp", 0, 0, picMerge) % Corner image
    var fontID1 : int := Font.New ("Impact:32:bold")
    Font.Draw ("GDHS", 345, 450, fontID1, black)
    var fontID2 : int := Font.New ("Georgia:24:bold")
    Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
    var fontID3 : int := Font.New ("Georgia:24:bold")
    Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)


    var fontID4 : int := Font.New ("Times New Roman:20:bold")
    Font.Draw ("::Credits:.", 238, 325, fontID4, black)

    drawline (0, 451, 800, 451, black)
    drawline (0, 450, 800, 450, black)
    locate (16, 40)
    put "PROGRAMMER TEAM"
    locate (17, 40)
    put "Lead Programmer- Josh English"
    locate (18, 40)
    put "Co-Programmer- Matt Watts"

    locate (20, 40)
    put "OTHER"
    locate (21, 40)
    put "Manual- Matt Watts"
    locate (22, 40)
    put "FlowChart- Matt Watts"


    locate (24, 40)
    put "OTHER RESOURCES"
    locate (25, 40)
    put "Turing 4.0.5"
    locate (26, 40)
    put "Turing Reference"
    locate (27, 40)
    put "Images- www.google.com"
    locate (28, 40)
    put "Teacher- Mr. Bhathal"

end credit


procedure manual
    %disable
    % hide
    cls
    Pic.ScreenLoad ("bstang.bmp", 0, 0, picMerge) % Corner image
    var fontID1 : int := Font.New ("Impact:32:bold")
    Font.Draw ("GDHS", 345, 450, fontID1, black)
    var fontID2 : int := Font.New ("Georgia:24:bold")
    Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
    var fontID3 : int := Font.New ("Georgia:24:bold")
    Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
    var fontID4 : int := Font.New ("Times New Roman:20:bold")
    Font.Draw ("::Manual:.", 238, 325, fontID4, black)
    drawline (0, 451, 800, 451, black)
    drawline (0, 450, 800, 450, black)
    locate (17, 40)
    put "This is the manual"
    locate (18, 40)
    put "First you will blah blah...!..."
    locate (19, 40)
    put "Watts is writting the rest of this :)!"

end manual

procedure done
    disable
    hide
    cls
    Music.PlayFileStop
    var fontID1 : int := Font.New ("Impact:32:bold")
    Font.Draw ("Thank You For Using This Program!", 75, 275, fontID1, black) %Quit Message
    Text.Locate (4, 48)
    put "Receipt Program"
    Text.Locate (5, 50)
    put "VERSION 0.5"
    delay (1000)
    Window.Close (window)
end done

procedure version
    %disable
    %hide
    cls
    Text.Locate (4, 38)
    put "Receipt Program"
    Text.Locate (5, 40)
    put "VERSION 1.0"
    Text.Locate (10, 30)
    put "Source code is open for users to improve"
    Text.Locate (15, 28)
    put "CREATED USING THE TURING PROGRAMMING LANGUAGE"
end version

%------------------MAIN MENU------------------------------------
Pic.ScreenLoad ("mustang.bmp", 0, 0, picMerge) % Background image

var fontID1 : int := Font.New ("Impact:32:bold")
Font.Draw ("GDHS", 345, 450, fontID1, black)
var fontID2 : int := Font.New ("Georgia:24:bold")
Font.Draw ("TRANSPORTATION", 230, 425, fontID2, black)
var fontID3 : int := Font.New ("Georgia:24:bold")
Font.Draw ("DEPARTMENT", 258, 400, fontID3, black)
drawline (0, 451, 800, 451, black)
drawline (0, 450, 800, 450, black)

var fontID4 : int := Font.New ("Times New Roman:20:bold")
Font.Draw ("::Menu:.", 238, 325, fontID4, 0)


Music.PlayFileLoop ("bgmusic.mp3") %Music is only temperary until I find something else, darn annoying street and car sounds


%-----------------Buttons & vars- Main Menu----------------------
locate (17, 48)
put "-Create a receipt" .. %Start info
var startb : int := GUI.CreateButton (300, 275, 70, "Start", start)
locate (19, 48)
put "-See who made this program" .. %Credit info
var creditb : int := GUI.CreateButton (300, 242, 70, "Credits", credit)
locate (21, 48)
put "-Instructions on how to use this program" .. %Manual info
var manualb : int := GUI.CreateButton (300, 210, 70, "Manual", manual)
locate (23, 48)
put "-Quit the program" .. %Quit info
var doneb : int := GUI.CreateButton (300, 178, 70, "Quit", done)
%----------------------------------------------------------------



file := GUI.CreateMenu ("File")
item (1) := GUI.CreateMenuItem (namei (1), done)

view := GUI.CreateMenu ("View")
item (2) := GUI.CreateMenuItem (namei (2), start)
item (3) := GUI.CreateMenuItem (namei (3), credit)

help := GUI.CreateMenu ("Help")
item (4) := GUI.CreateMenuItem (namei (4), manual)
item (5) := GUI.CreateMenuItem (namei (5), version)


body proc disable
    GUI.Disable (startb)
    GUI.Disable (creditb)
    GUI.Disable (manualb)
    GUI.Disable (doneb)
    GUI.Disable (file)
    GUI.Disable (view)
    GUI.Disable (help)
end disable

body proc hide
    GUI.Hide (file)
    GUI.Hide (view)
    GUI.Hide (help)
    GUI.Hide (startb)
    GUI.Hide (creditb)
    GUI.Hide (manualb)
    GUI.Hide (doneb)
end hide

loop
    exit when GUI.ProcessEvent
end loop

cls
Music.PlayFileStop
var fontID : int := Font.New ("Impact:32:bold")
Font.Draw ("Thank You For Using This Program!", 75, 275, fontID1, black)     %Quit Message
Text.Locate (4, 48)
put "Receipt Program"
Text.Locate (5, 50)
put "VERSION 1.0"
delay (1000)
Window.Close (window)
%END OF PROGRAM :)


Help PLEASE! Smile Thank you!
Sponsor
Sponsor
Sponsor
sponsor
SuperGenius




PostPosted: Tue Nov 16, 2004 3:38 pm   Post subject: (No subject)

If you could highlight the part of the code that is giving you a problem it would be a lot easier for someone to help you.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: