home *** CD-ROM | disk | FTP | other *** search
- unit FF; { Find Fone }
-
- interface
- uses Crt, Def, SetBU, GetForU, ShadoU, ColorDef, FastWr, CPaU,
- RE, GetKeU, UCasU, ShowPagU, StriU, StrnU;
- procedure FindPhone;
-
- implementation
-
- procedure FindPhone;
- var Phone1,
- Phone2: array [1..1700] of s12;
- TempStr,
- Query: s12;
- Count,
- AllowControl,
- I: integer;
- FunctionKey,
- AllowInput,
- Found: boolean;
- Ch: char;
- begin
- SetBG;
- clrscr;
- AllowInput := true;
- AllowControl := -1;
- Query := '';
- if FileTop > MostPhone then
- Count := MostPhone
- else
- Count := FileTop;
- Shadow( 30, 10, 50, 15, Headings.Attr, true);
- FastWrite( CPad('Loading',10), 12, 35, Headings.Attr);
- for I := 1 to Count do
- begin
- if (I mod 10) = 0 then
- begin
- str(I,TempStr);
- FastWrite( CPad(TempStr,10), 13, 35, Msgs.Attr);
- end;
- GetRec(Entry,I);
- Phone1[I] := Entry.Phone1;
- Phone2[I] := Entry.Phone2;
- end;
- while UCase(Query) <> 'END' do
- begin
- clrscr;
- Found := false;
- FastWrite( CPad('Enter phone number. Partials are acceptable.',78), 2, 2, Msgs.Attr);
- FastWrite( CPad('Type "END" and strike [ENTER] to exit.',78), 3, 2, Msgs.Attr);
- Query := Strip( GetForm( 35, 6, -13, Strng(13,#32), Query,
- AllowControl, AllowInput,
- (Inputs.Attr or $0008), [#31..#126]));
- if (AllowControl = -27) or (AllowInput = false) then Query := 'END';
- if UCase(Query) <> 'END' then
- begin
- I := FileTop;
- while (not Found) and (I > 0) do
- begin
- J := pos(Query,Phone1[I]);
- if J <> 0 then Found := true;
- J := pos(Query,Phone2[I]);
- if J <> 0 then Found := true;
- if Found then
- begin
- GetRec(Entry,I);
- ShowPage;
- FastWrite( CPad('Hit F1 to continue or any other key to quit.',80), 15, 1, Msgs.Attr);
- GetKey(Ch,FunctionKey);
- if Ch = #59 then
- begin
- Found := false;
- dec(I);
- end
- else
- if Ch = #27 then
- AllowInput := false
- else
- Query := Ch;
- end
- else
- dec(I);
- end; (* inner while loop *)
- end; (* if..then *)
- end; (* outer while loop *)
- end;
-
- end.
-