home *** CD-ROM | disk | FTP | other *** search
- program DB_Xpl08;
- uses
- CRT,
- DOS,
- Printer,
- GS_KeyI,
- GS_Pick,
- GS_Winfc,
- GS_dBFld,
- GS_dBTbl,
- GS_dBase;
-
- const
- Initial_Choice : array [1..3] of string[9] =
- (' Choose ',' Print ',' Exit ');
-
- var
- Health : GS_dBFld_Objt;
- HlthTab : dbTabl_Pick_Obj;
-
- AskWin,
- StatusWin,
- HlthWin : GS_Wind_Objt;
-
- procedure ShowFile;
- begin
- StatusWin.SetWin;
- write('':10,'ESC to Abort, F10 to Quit and Save,',
- ' F9 to Delete/Undelete');
- HlthWin.SetWin;
- if HlthTab.Addrec then
- begin
- Health.Blank;
- if Health.FieldUpdateScreen then
- begin
- Health.Append;
- HlthTab.Reset_dBTabl;
- end;
- end
- else
- if Health.FieldUpdateScreen then Health.PutRec(Health.RecNumber);
- HlthWin.RelWin;
- StatusWin.RelWin;
- end;
-
- procedure FileDisplay;
- var
- t : string[8];
- i : integer;
- z,
- wcr : boolean;
- begin
- wcr := Health.Wait_CR;
- Health.Wait_Cr := true;
- AskWin.NamWin('[ Food Name ]');
- AskWin.SetWin;
- gotoxy(1,1);
- write('Enter food name:');
- t := Health.EditString('',8,3,20);
- Health.Wait_CR := wcr;
- HlthTab.Reset_dBTabl;
- repeat
- StatusWin.SetWin;
- write('':22,'ESC to Exit, RETURN to Select Entry');
- if HlthTab.Tabl = nil then
- z := HlthTab.Scan_dBTabl('FOOD',t,'FOOD+" ("+FOOD_CODE+")"')
- else
- begin
- HlthTab.Pick_Win.SetWin;
- z := HlthTab.Choose_dBTabl;
- HlthTab.Pick_Win.RelWin;
- end;
- StatusWin.RelWin;
- if z then ShowFile;
- until not z;
- HlthTab.Reset_dBTabl;
- AskWin.RelWin
- end;
-
- procedure Print_List;
- begin
- ClrScr;
- writeln(lst,' REC# FOOD CODE',
- ' QUANT MEASUR CALORIES');
- writeln(lst);
- with Health do
- begin
- GetRec(Top_Record);
- while not File_EOF do
- begin
- writeln(FieldGet('food'):20,
- FieldGet('food_code'):8,
- FieldGet('quantity'):8,
- FieldGet('unittype'):5,
- FieldGet('cals'):6);
- writeln(lst,RecNumber:6,
- FieldGet('food'):24,
- FieldGet('food_code'):8,
- FieldGet('quantity'):8,
- FieldGet('unittype'):10,
- FieldGet('cals'):12);
- GetRec(Next_Record);
- end;
- end;
- writeln(lst,#12);
- end;
-
- procedure What_Now;
- var
- c1 : char;
- q : integer;
- begin
- q := 1;
- while q < 3 do
- begin
- StatusWin.SetWin;
- q := GS_Pick_Line_Item(Initial_Choice,10,3,q);
- StatusWin.RelWin;
- case q of
- 0 : q := 3;
- 1 : FileDisplay;
- 2 : Print_List;
- end;
- end;
- end;
-
- begin
- ClrScr;
- Health.Init('HEALTH');
- Health.Open;
- Health.Index('FOODNAME');
- HlthTab.Init_dbTabl(Health, '[ FOODS ]',20,2,60,22,
- Yellow,Green,LightGray,Black,LightGray);
- HlthWin.InitWin(1,1,80,24,Yellow,blue,Yellow,Blue,LightGray,True,
- '[ FILE INFORMATION ]',true);
- AskWin.InitWin(20,8,60,12,Yellow,Blue,Yellow,Black,LightGray,true,
- '',true);
- StatusWin.InitWin(1,25,80,25,Yellow,Red,Yellow,Red,LightGray,false,'',true);
- HlthTab.Append_dBTabl(true);
- What_Now;
- Health.Close;
- end.
-