home *** CD-ROM | disk | FTP | other *** search
- program GSdBData;
- uses
- CRT,
- DOS,
- Printer,
- GS_KeyI,
- GS_dBFld,
- GS_Pick,
- GS_Wind,
- GS_dBTbl,
- GS_dBase;
-
- const
-
- Initial_Count = 5;
- Initial_Choice : array [1..Initial_Count] of string[9] =
- (' Choose ',' Print ',' FileIt ',' Pack ',' Exit ');
-
- var
- GSdBFile : GS_dBFld_Objt;
- AskWin,
- StatusWin,
- GSdBWin,
- GSMoWin : GS_Wind_Objt;
- GSdBTab : dbTabl_Pick_Obj;
-
- procedure ShowFile;
- var
- i,
- ml : integer;
- vl,
- vs : boolean;
- aw : string[1];
- begin
- StatusWin.SetWin;
- write('':10,'ESC to Abort, F10 to Quit and Save,',
- ' F9 to Delete/Undelete');
- vl := true;
- while vl do
- begin;
- GSMoWin.SetWin;
- ClrScr;
- if not GSdBTab.Addrec then
- begin
- GSdBFile.MemoGet(GSdBFile.FieldGet('COMMENTS'));
- ml := GSdBFile.MemoLines;
- if ml > 12 then ml := 12;
- for i := 1 to ml do
- begin
- gotoxy(1,i);
- write(GSdBFile.MemoGetLine(i));
- end;
- end;
- GSdBWin.SetWin;
- ClrScr;
- if GSdBTab.Addrec then
- begin
- vs := false;
- vl := GSdBFile.FieldAppendScreen(false);
- if not vl then
- begin
- if GSdBFile.RecChanged then
- begin
- AskWin.BoxName := '';
- AskWin.SetWin;
- gotoxy(1,2);
- writeln(' Record has been modified!');
- write(' Save before exit? ');
- aw := GSdBFile.EditString('Y',21,3,1);
- vs := aw[1] in ['T','t','Y','y'];
- AskWin.RelWin;
- end;
- end;
- if vl or vs then
- begin
- GSdBFile.Append;
- GSdBTab.Reset_dBTabl;
- end;
- end
- else
- begin
- vs := false;
- vl := GSdBFile.FieldUpdateScreen;
- if not vl then
- begin
- if GSdBFile.RecChanged then
- begin
- AskWin.BoxName := '';
- AskWin.SetWin;
- gotoxy(1,2);
- writeln(' Record has been modified!');
- write(' Save before exit? ');
- aw := GSdBFile.EditString('Y',21,3,1);
- vs := aw[1] in ['T','t','Y','y'];
- AskWin.RelWin;
- end;
- end;
- if vl or vs then
- begin
- GSdBFile.PutRec(GSdBFile.RecNumber);
- if GS_KeyI_Chr = Kbd_PgUp then
- GSdBFile.GetRec(Prev_Record)
- else
- GSdBFile.GetRec(Next_Record);
- end;
- end;
- GSdBWin.RelWin;
- GSMoWin.RelWin;
- end;
- StatusWin.RelWin;
- end;
-
-
- procedure FileDisplay;
- var
- t : string[8];
- i : integer;
- z,
- wcr : boolean;
- begin
- wcr := GSdBFile.Wait_CR;
- GSdBFile.Wait_Cr := true;
- AskWin.boxname := '[ Label Name ]';
- AskWin.SetWin;
- gotoxy(1,1);
- write('Enter label name:');
- t := GSdBFile.EditString('',8,2,20);
- GSdBFile.Wait_CR := wcr;
- AskWin.RelWin;
- if GS_KeyI_Esc then exit;
- GSdBTab.Reset_dBTabl;
- repeat
- StatusWin.SetWin;
- write('':22,'ESC to Exit, RETURN to Select Entry');
- if GSdBTab.Tabl = nil then
- z := GSdBTab.Scan_dBTabl('LABEL',t,'LABEL+" ["+OBJECT+"]"')
- else
- begin
- GSdBTab.Pick_Win.SetWin;
- z := GSdBTab.Choose_dBTabl;
- GSdBTab.Pick_Win.RelWin;
- end;
- StatusWin.RelWin;
- if z then ShowFile;
- until not z;
- GSdBTab.Reset_dBTabl;
- end;
-
- procedure Print_List;
- var
- i,
- ml,
- lines : integer;
-
- procedure Page_Top;
- begin
- if lines > 0 then writeln(lst,#12);
- lines := 0;
- end;
-
- begin
- lines := 0;
- Page_Top;
- ClrScr;
- with GSdBFile do
- begin
- GetRec(Top_Record);
- while not File_EOF do
- begin
- writeln(FieldGet('label'),
- FieldGet('type'):12,
- FieldGet('unit'):25);
- if lines > 56 then Page_Top;
- writeln(lst);
- writeln(lst,'__________________________________________________');
- writeln(lst);
- inc(lines,3);
- writeln(lst,
- FieldGet('label'),
- FieldGet('type'):12,
- ' Unit: ',
- FieldGet('unit'));
- inc(lines);
- writeln(lst);
- inc(lines);
- MemoGet(FieldGet('COMMENTS'));
- ml := MemoLines;
- for i := 1 to ml do
- begin
- writeln(lst,MemoGetLine(i));
- inc(lines);
- if lines > 60 then Page_Top;
- end;
- if lines > 60 then Page_Top;
- GetRec(Next_Record);
- end;
- end;
- writeln(lst,#12);
- end;
-
- procedure File_List;
- var
- i,
- ml,
- lines : integer;
- fil : text;
-
- begin
- assign(fil,'gsdblist.txt');
- rewrite(fil);
- ClrScr;
- with GSdBFile do
- begin
- GetRec(Top_Record);
- while not File_EOF do
- begin
- writeln(FieldGet('label'),
- FieldGet('type'):12,
- FieldGet('unit'):25);
- writeln(fil,'__________________________________________________');
- writeln(fil);
- writeln(fil,
- #02,FieldGet('label'),#02,
- FieldGet('type'):12,
- ' Unit: ',
- FieldGet('unit'));
- writeln(fil);
- MemoGet(FieldGet('COMMENTS'));
- ml := MemoLines;
- for i := 1 to ml do
- begin
- writeln(fil,MemoGetLine(i));
- end;
- GetRec(Next_Record);
- end;
- end;
- system.close(fil);
- end;
-
- procedure What_Now;
- var
- c1 : char;
- q : integer;
- begin
- q := 1;
- while q < Initial_Count do
- begin
- StatusWin.SetWin;
- q := GS_Pick_Line_Item(Initial_Choice,10,Initial_Count,q);
- StatusWin.RelWin;
- case q of
- 1 : FileDisplay;
- 2 : Print_List;
- 3 : File_List;
- 4 : GSdBFile.Pack;
- end;
- end;
- end;
-
- begin
- ClrScr;
- GSdBFile.Init('GSDBDATA');
- GSdBFile.Open;
- { GSdBFile.IndexTo('GSDBDATA','SECTION+LABEL');}
- GSdBFile.Index('GSDBDATA');
- GSdBFile.MemoWidth(72);
- GSdbWin.InitWin(1,1,80,10,Yellow,Green,LightGray,Yellow,Red,true,
- '',false);
- GSMoWin.InitWin(1,11,80,24,Black,Green,LightGray,Yellow,Red,true,
- '[ COMMENTS ]',false);
- AskWin.InitWin(20,8,60,11,Yellow,Blue,Yellow,Black,LightGray,true,
- '',true);
- StatusWin.InitWin(1,25,80,25,Yellow,Red,Yellow,Red,LightGray,false,'',true);
- GSdBTab.Init_dbTabl(GSdBFile, '[ ITEMS ]',10,2,70,22,
- Yellow,Blue,LightGray,Blue,LightGray);
- GSdBTab.Append_dBTabl(true);
- What_Now;
- GSdBFile.Close;
- end.