home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / mailpro / ff.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1988-08-23  |  2.4 KB  |  89 lines

  1. unit FF;   { Find Fone }
  2.  
  3. interface
  4. uses Crt,     Def,    SetBU,   GetForU,  ShadoU, ColorDef, FastWr, CPaU,
  5.      RE,      GetKeU, UCasU,   ShowPagU, StriU,  StrnU;
  6. procedure FindPhone;
  7.  
  8. implementation
  9.  
  10. procedure FindPhone;
  11. var Phone1,
  12.     Phone2:       array [1..1700] of s12;
  13.     TempStr,
  14.     Query:        s12;
  15.     Count,
  16.     AllowControl,
  17.     I:            integer;
  18.     FunctionKey,
  19.     AllowInput,
  20.     Found:        boolean;
  21.     Ch:           char;
  22. begin
  23. SetBG;
  24. clrscr;
  25. AllowInput := true;
  26. AllowControl := -1;
  27. Query := '';
  28. if FileTop > MostPhone then
  29.    Count := MostPhone
  30.   else
  31.    Count := FileTop;
  32. Shadow( 30, 10, 50, 15, Headings.Attr, true);
  33. FastWrite( CPad('Loading',10), 12, 35, Headings.Attr);
  34. for I := 1 to Count do
  35.     begin
  36.     if (I mod 10) = 0 then
  37.        begin
  38.        str(I,TempStr);
  39.        FastWrite( CPad(TempStr,10), 13, 35, Msgs.Attr);
  40.        end;
  41.     GetRec(Entry,I);
  42.     Phone1[I] := Entry.Phone1;
  43.     Phone2[I] := Entry.Phone2;
  44.     end;
  45. while UCase(Query) <> 'END' do
  46.    begin
  47.    clrscr;
  48.    Found := false;
  49.    FastWrite( CPad('Enter phone number.  Partials are acceptable.',78), 2, 2, Msgs.Attr);
  50.    FastWrite( CPad('Type "END" and strike [ENTER] to exit.',78), 3, 2, Msgs.Attr);
  51.    Query := Strip( GetForm( 35, 6, -13, Strng(13,#32), Query,
  52.                             AllowControl, AllowInput,
  53.                             (Inputs.Attr or $0008), [#31..#126]));
  54.    if (AllowControl = -27) or (AllowInput = false) then Query := 'END';
  55.    if UCase(Query) <> 'END' then
  56.       begin
  57.       I := FileTop;
  58.       while (not Found) and (I > 0) do
  59.          begin
  60.          J := pos(Query,Phone1[I]);
  61.          if J <> 0 then Found := true;
  62.          J := pos(Query,Phone2[I]);
  63.          if J <> 0 then Found := true;
  64.          if Found then
  65.             begin
  66.             GetRec(Entry,I);
  67.             ShowPage;
  68.             FastWrite( CPad('Hit F1 to continue or any other key to quit.',80), 15, 1, Msgs.Attr);
  69.             GetKey(Ch,FunctionKey);
  70.             if Ch = #59 then
  71.                begin
  72.                Found := false;
  73.                dec(I);
  74.                end
  75.               else
  76.                if Ch = #27 then
  77.                   AllowInput := false
  78.                  else
  79.                   Query := Ch;
  80.             end
  81.          else
  82.             dec(I);
  83.          end;    (* inner while loop *)
  84.       end;       (* if..then *)
  85.    end;          (* outer while loop *)
  86.  end;
  87.  
  88. end.
  89.