big turing program with gui i dont understand andneed help
Author |
Message |
djwhiterice
|
Posted: Thu Mar 04, 2004 9:33 pm Post subject: big turing program with gui i dont understand andneed help |
|
|
[b]ok well its kinda a biggy
try running this program
____________________________________________________________
import GUI in "%oot/lib/GUI"
View.Set ("graphics:800;600,nobuttonbar")
var Open : int
var item : array 1 .. 8 of int
var x1,x2,x3,x4,x5,x6,x7,x8:int:=0
var name : array 1 .. 8 of string (60) :=
init ("#1-Instruction Pages","#2-Enter Employee Information","#3-Display Employee Information","#4-Display Employee Information",
"#5-Display Employee Pay Information","#6-Display Employee Hiring/Age Information","#7-Edit Employee Information","#8-Exit")
procedure Instructions
locate(1,1)
put "Instructions"
end Instructions
procedure Employee_Info_Entry
locate(1,1)
put "Employee_Info_Entry"
end Employee_Info_Entry
procedure Employee_Info_Unformatted
locate(1,1)
put "Employee_Info_Unformatted"
end Employee_Info_Unformatted
procedure Employee_Info_Table
locate(1,1)
put "Employee_Info_Table"
end Employee_Info_Table
procedure Employee_Pay
locate(1,1)
put "Employee_Pay"
end Employee_Pay
procedure Hiring_Age_Info
locate(1,1)
put "Hiring_Age_Info"
end Hiring_Age_Info
procedure Edit_Employee_Info
locate(1,1)
put "Edit_Employee_Info"
end Edit_Employee_Info
procedure bye
x1:=39
x2:=40
x3:=41
x4:=42
x5:=43
x6:=44
x7:=45
x8:=46
colorback(7)
cls
loop
for i: 1..8
x1:=x1+1
x2:=x2+1
x3:=x3+1
x4:=x4+1
x5:=x5+1
x6:=x6+1
x7:=x7+1
x8:=x8+1
color(x1)
delay(50)
locate(9,3
put "g"..
color(x2)
delay(50)
locate(10,3
put "o"..
color(x3)
delay(50)
locate(11,3
put "o"..
color(x4)
delay(50)
locate(12,3
put "d"..
locate(13,3
put " "..
color(x5)
delay(50)
locate(14,3
put "b"..
color(x6)
delay(50)
locate(15,3
put "y"..
color(x7)
delay(50)
locate(16,3
put "e"..
end for
exit when x1>=55
end loop
end bye
Open := GUI.CreateMenu ("Open")
item (1) := GUI.CreateMenuItem (name (1), Instructions)
item (2) := GUI.CreateMenuItem (name (2), Employee_Info_Entry)
item (3) := GUI.CreateMenuItem (name (3), Employee_Info_Unformatted)
item (4) := GUI.CreateMenuItem (name (4), Employee_Info_Table)
item (5) := GUI.CreateMenuItem (name (5), Employee_Pay)
item (6) := GUI.CreateMenuItem (name (6), Hiring_Age_Info)
item (7) := GUI.CreateMenuItem (name (7), Edit_Employee_Info)
item ( := GUI.CreateMenuItem (name (, bye)
loop
exit when GUI.ProcessEvent
end loop
_____________________________________________________________
under the procedure Employee_Info_Entry(program above) i wanna put this stuff:
_____________________________________________________________
import GUI in "%oot/support/lib/GUI"
View.Set ("graphics:800;600")
% The Text Field IDs
var titleTextField, firstnameTextField, lastnameTextField, addressTextField, cityTextField, provTextField,
postalTextField, datehiredTextField, sexTextField , ageTextField ,hoursworkedTextField , hourlyrateTextField : int
var z:=180
% a slider
var scrollBar : int
% label for record
var recordLabel : int
% The array for data
var data : array 1 .. 200 of
record
title : string
firstname : string
lastname : string
address : string
city : string
prov : string
postal : string
datehired : string
sex : string
age : string
hourswork : string
hourlyrate : string
end record
var numRecords : int := 1
var currentRecord : int := 1
for i : 1 .. 200
data (i).title := ""
data (i).firstname := ""
data (i).lastname := ""
data (i).address := ""
data (i).city := ""
data (i).prov := ""
data (i).postal := ""
data (i).datehired := ""
data (i).sex := ""
data (i).age := ""
data (i).hourswork := ""
data (i).hourlyrate:= ""
end for
procedure ChooseRecord (recordNumber : int)
% Save the current data
data (currentRecord).title := GUI.GetText (titleTextField)
data (currentRecord).firstname := GUI.GetText (firstnameTextField)
data (currentRecord).lastname:= GUI.GetText (lastnameTextField)
data (currentRecord).address := GUI.GetText (addressTextField)
data (currentRecord).city := GUI.GetText (cityTextField)
data (currentRecord).prov := GUI.GetText (provTextField)
data (currentRecord).postal := GUI.GetText (postalTextField)
data (currentRecord).datehired := GUI.GetText (datehiredTextField)
data (currentRecord).sex := GUI.GetText (sexTextField)
data (currentRecord).age := GUI.GetText (ageTextField)
data (currentRecord).hourswork := GUI.GetText (hoursworkedTextField)
data (currentRecord).hourlyrate := GUI.GetText (hourlyrateTextField)
% Place the new current record in the text fields
currentRecord := recordNumber
GUI.SetText (titleTextField, data (currentRecord).title)
GUI.SetText (firstnameTextField, data (currentRecord).firstname)
GUI.SetText (lastnameTextField, data (currentRecord).lastname)
GUI.SetText (addressTextField, data (currentRecord).address)
GUI.SetText (cityTextField, data (currentRecord).city)
GUI.SetText (provTextField, data (currentRecord).prov)
GUI.SetText (postalTextField, data (currentRecord).postal)
GUI.SetText (datehiredTextField, data (currentRecord).datehired)
GUI.SetText (sexTextField, data (currentRecord).sex)
GUI.SetText (ageTextField, data (currentRecord).age)
GUI.SetText (hoursworkedTextField, data (currentRecord).hourswork)
GUI.SetText (hourlyrateTextField, data (currentRecord).hourlyrate)
% Set the label to indicate the current record
GUI.SetLabel (recordLabel, "Record " + intstr (recordNumber) + " of " +
intstr (numRecords))
% Set the selections to cover all the text in each of the text fields
GUI.SetSelection (titleTextField, -1, -1)
% Make the name field the active text field
GUI.SetActive (titleTextField)
GUI.SetSelection (firstnameTextField, -1, -1)
GUI.SetSelection (lastnameTextField, -1, -1)
GUI.SetSelection (addressTextField, -1, -1)
GUI.SetSelection (cityTextField, -1, -1)
GUI.SetSelection (provTextField, -1, -1)
GUI.SetSelection (postalTextField, -1, -1)
GUI.SetSelection (datehiredTextField, -1, -1)
GUI.SetSelection (sexTextField, -1, -1)
GUI.SetSelection (ageTextField, -1, -1)
GUI.SetSelection (hoursworkedTextField, -1, -1)
GUI.SetSelection (hourlyrateTextField, -1, -1)
end ChooseRecord
procedure AddRecord
numRecords += 1
GUI.SetSliderMinMax (scrollBar, 1, numRecords)
% GUI.SetSliderValue calls ChooseRecord automatically
GUI.SetSliderValue (scrollBar, numRecords)
end AddRecord
%1
procedure Title (text : string)
GUI.SetSelection (firstnameTextField, -1, -1)
GUI.SetActive (firstnameTextField)
end Title
%2
procedure Firstname (text : string)
GUI.SetSelection (lastnameTextField, -1, -1)
GUI.SetActive (lastnameTextField)
end Firstname
%3
procedure Lastname (text : string)
GUI.SetSelection (addressTextField, -1, -1)
GUI.SetActive (addressTextField)
end Lastname
%4
procedure Address (text : string)
GUI.SetSelection (lastnameTextField, -1, -1)
GUI.SetActive (lastnameTextField)
end Address
%5
procedure City (text : string)
GUI.SetSelection (provTextField, -1, -1)
GUI.SetActive (provTextField)
end City
%6
procedure Prov (text : string)
GUI.SetSelection (postalTextField, -1, -1)
GUI.SetActive (postalTextField)
end Prov
%7
procedure Postal (text : string)
GUI.SetSelection (datehiredTextField, -1, -1)
GUI.SetActive (datehiredTextField)
end Postal
%8
procedure DateHired (text : string)
GUI.SetSelection (sexTextField, -1, -1)
GUI.SetActive (sexTextField)
end DateHired
%9
procedure Sex (text : string)
GUI.SetSelection (ageTextField, -1, -1)
GUI.SetActive (ageTextField)
end Sex
%10
procedure Age (text : string)
GUI.SetSelection (hoursworkedTextField, -1, -1)
GUI.SetActive (hoursworkedTextField)
end Age
%11
procedure Hoursworked (text : string)
GUI.SetSelection (hourlyrateTextField, -1, -1)
GUI.SetActive (hourlyrateTextField)
end Hoursworked
procedure Hourlyrate (text : string)
if currentRecord = numRecords then
AddRecord
else
GUI.SetSliderValue (scrollBar, currentRecord + 1)
% GUI.SetSliderValue calls ChooseRecord automatically
end if
end Hourlyrate
GUI.SetBackgroundColour (gray)
recordLabel := GUI.CreateLabelFull (100, 390+z, "Record 1 of 1", 100, 0,
GUI.CENTER, 0)
titleTextField := GUI.CreateTextFieldFull (100, 370+z, 100, "", Title,
GUI.INDENT, 0, 0)
firstnameTextField := GUI.CreateTextFieldFull (100, 340+z, 100, "", Firstname,
GUI.INDENT, 0, 0)
lastnameTextField := GUI.CreateTextFieldFull (100, 310+z, 100, "", Lastname,
GUI.INDENT, 0, 0)
addressTextField := GUI.CreateTextFieldFull (100, 280+z, 100, "", Address,
GUI.INDENT, 0, 0)
cityTextField := GUI.CreateTextFieldFull (100, 250+z, 100, "", City,
GUI.INDENT, 0, 0)
provTextField := GUI.CreateTextFieldFull (100, 220+z, 100, "", Prov,
GUI.INDENT, 0, 0)
postalTextField := GUI.CreateTextFieldFull (100, 190+z, 100, "", Postal,
GUI.INDENT, 0, 0)
datehiredTextField := GUI.CreateTextFieldFull (100, 160+z, 100, "", DateHired,
GUI.INDENT, 0, 0)
sexTextField := GUI.CreateTextFieldFull (100, 130+z, 100, "", Sex,
GUI.INDENT, 0, 0)
ageTextField := GUI.CreateTextFieldFull (100, 100+z, 100, "", Age,
GUI.INDENT, 0, 0)
hoursworkedTextField := GUI.CreateTextFieldFull (100, 70+z, 100, "", Hoursworked,
GUI.INDENT, 0, 0)
hourlyrateTextField := GUI.CreateTextFieldFull (100, 40+z, 100, "", Hourlyrate,
GUI.INDENT, 0, 0)
var titleLabel := GUI.CreateLabelFull (95, 370+z, "Title", 0, 0, GUI.RIGHT, 0)
var firstnameLabel := GUI.CreateLabelFull (95, 340+z, "First Name", 0, 0, GUI.RIGHT,0)
var lastnameLabel := GUI.CreateLabelFull (95, 310+z, "Last Name", 0, 0, GUI.RIGHT, 0)
var addressLabel := GUI.CreateLabelFull (95, 280+z, "Address", 0, 0, GUI.RIGHT, 0)
var citynameLabel := GUI.CreateLabelFull (95, 250+z, "City", 0, 0, GUI.RIGHT,0)
var provinceLabel := GUI.CreateLabelFull (95, 220+z, "Province", 0, 0, GUI.RIGHT, 0)
var postalLabel := GUI.CreateLabelFull (95, 190+z, "Postal Code", 0, 0, GUI.RIGHT, 0)
var datehiredLabel := GUI.CreateLabelFull (95, 160+z, "Date Hired", 0, 0, GUI.RIGHT,0)
var sexLabel := GUI.CreateLabelFull (95, 130+z, "Sex", 0, 0, GUI.RIGHT, 0)
var ageLabel := GUI.CreateLabelFull (95, 100+z, "Age", 0, 0, GUI.RIGHT, 0)
var hoursworkedlabel := GUI.CreateLabelFull (95, 70+z, "Hours Worked", 0, 0, GUI.RIGHT,0)
var hourlyrateLabel := GUI.CreateLabelFull (95, 40+z, "Hourly Rate", 0, 0, GUI.RIGHT, 0)
var addRecord := GUI.CreateButton (99, 5+z, 100, "Add Record", AddRecord)
scrollBar := GUI.CreateVerticalScrollBarFull (210, 38+z, 350, 1, 1, 1,ChooseRecord, 1, 5, 0)
GUI.SetSliderReverse (scrollBar)
loop
exit when GUI.ProcessEvent
end loop
_____________________________________________________________
im new at gui so i dont know how to do it
how would i go about doin this? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
poly
|
Posted: Thu Mar 04, 2004 9:41 pm Post subject: (No subject) |
|
|
First of all:
Buggy...naah its not buggy at all because it WONT RUN! You need to fix ALL the errors in your program, your missing the ")" on your located, in your code you have "(" when you should have ")".etc etc etc
Also you might want to elaborate on what you cant do? |
|
|
|
|
|
jonos
|
Posted: Thu Mar 04, 2004 10:25 pm Post subject: (No subject) |
|
|
you have 29 errors and 49 warnings, so nect time try to solve the mistakes by yourself instead of just putting here. next time you might want to also upload it so the page doesn't get so big.
also, you should tell us what you are trying to do, and that goes beyond buggy. |
|
|
|
|
|
|
|