body procedure guilishious (produ : string, manu : string)
View.Set ("graphics:650;400") % Enlarge the window to the maximum size
% The Text Field IDs
var textBox : int
% The label for the title
var title : int
% The name of the file to be viewed
const fileNameToBeViewed : string := "inventory.bin"
% Attempt to open the file. Put an error message if open fails
var f : int
open : f, fileNameToBeViewed, read
if f = 0 then
put "Unable to open '" + fileNameToBeViewed + "' : ", Error.LastMsg
return
end if
% We opened the file successfully. Now create the widgets.
GUI.SetBackgroundColour (grey)
% Create the title label
title := GUI.CreateLabelFull (20, 280, fileNameToBeViewed, 250, 0,
GUI.CENTER, 0)
% Create the text box
textBox := GUI.CreateTextBoxFull (10, 10, 630, 365, GUI.INDENT, 0)
% Read the file and place it in the text box.
var line : string
line := "Title Manufact Price #in stock warning # #to order product # Category Sale"
GUI.AddLine (textBox, line)
loop
exit when eof (f)
read : f, prod
if produ = manu then
line := prod.product + " | " + prod.manufacturer + " | $" + realstr (prod.price, 6) + " | " + intstr (prod.number) + " | " + intstr (prod.reorder) + " | " +
intstr (prod.numinstock) + " | " + prod.prodnumber + " | " + prod.cater + " | " + prod.sale
GUI.AddLine (textBox, line)
end if
end loop
close : f % Close the file
% Process Events
var mx, my, mbtn : int
var font1 : int
font1 := Font.New ("Arial:10")
drawfillbox (20, 380, 59, 395, 35)
Font.Draw ("BACK", 22, 382, font1, 0)
loop
if buttonmoved ("down") then
buttonwait ("down", mx, my, mbtn, mbtn)
if mbtn = 1 then
if mx > 20 and mx < 59 and my > 380 and my < 395 then
cls
displayinfo
end if
end if
end if
exit when GUI.ProcessEvent
end loop
end guilishious
%GUI display for all the files in the record
body proc _display
View.Set ("graphics:650;400") % Enlarge the window to the maximum size
% The Text Field IDs
var textBox : int
% The label for the title
var title : int
% The name of the file to be viewed
const fileNameToBeViewed : string := "inventory.bin"
% Attempt to open the file. Put an error message if open fails
var f : int
open : f, fileNameToBeViewed, read
if f = 0 then
put "Unable to open '" + fileNameToBeViewed + "' : ", Error.LastMsg
return
end if
% We opened the file successfully. Now create the widgets.
GUI.SetBackgroundColour (grey)
% Create the title label
title := GUI.CreateLabelFull (20, 280, fileNameToBeViewed, 250, 0,
GUI.CENTER, 0)
% Create the text box
textBox := GUI.CreateTextBoxFull (10, 10, 630, 365, GUI.INDENT, 0)
% Read the file and place it in the text box.
var line : string
line := "Title Manufact Price #in stock warning # #to order product # Category Sale"
GUI.AddLine (textBox, line)
loop
exit when eof (f)
read : f, prod
line := prod.product + " | " + prod.manufacturer + " | $" + realstr (prod.price, 6) + " | " + intstr (prod.number) + " | " + intstr (prod.reorder) + " | " +
intstr (prod.numinstock) + " | " + prod.prodnumber + " | " + prod.cater + " | " + prod.sale
GUI.AddLine (textBox, line)
end loop
% Process Events
var mx, my, mbtn : int
var font1 : int
font1 := Font.New ("Arial:10")
drawfillbox (20, 380, 59, 395, 35)
Font.Draw ("BACK", 22, 382, font1, 0)
loop
if buttonmoved ("down") then
buttonwait ("down", mx, my, mbtn, mbtn)
if mbtn = 1 then
if mx > 20 and mx < 59 and my > 380 and my < 395 then
cls
close : f % Close the file
exit
end if
end if
end if
exit when GUI.ProcessEvent
end loop
end _display |