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

  1. unit NS;
  2.  
  3. interface
  4. uses Crt,   GetForU, Def,    ColorDef, FindFile, LPaU, ShadoU, FastWr,
  5.      SetBU, StriU,   StrnU,  UCasU;
  6. procedure NameSearch;
  7.  
  8. implementation
  9.  
  10. procedure NameSearch;
  11. var Continue:      boolean;
  12.     I:             integer;
  13.     DisplayLines:  array [1..11] of S80;
  14.     AllowInput:    boolean;
  15.     ValidChar:     SetType;
  16.     AllowControl:  integer;
  17.  
  18.     procedure NameSearchHelp;
  19.     var I,
  20.         J:    integer;
  21.     begin
  22.     I := 0;
  23.     inc(I);
  24.     DisplayLines[I] := 'To start at the beginning of the list, simply strike [ENTER].';
  25.     inc(I);
  26.     DisplayLines[I] := ' ';
  27.     inc(I);
  28.     DisplayLines[I] := ' ';
  29.     inc(I);
  30.     DisplayLines[I] := 'If you type an entry here, the computer finds the first word that';
  31.     inc(I);
  32.     DisplayLines[I] := 'occurs which starts with the entered sequence of letters.';
  33.     inc(I);
  34.     DisplayLines[I] := 'For example, if you enter "C" the first name that starts with "C" is';
  35.     inc(I);
  36.     DisplayLines[I] := 'listed at the top of the screen.  If you enter "CAR" then the';
  37.     inc(I);
  38.     DisplayLines[I] := 'computer begins listing from the first name that begins with "CAR".';
  39.     inc(I);
  40.     DisplayLines[I] := 'In this way not only portions of names, but also entire names may be';
  41.     inc(I);
  42.     DisplayLines[I] := 'entered.';
  43.     for J := 1 to I do DisplayLines[J] := LPad(DisplayLines[J],68);
  44.     Shadow( 3, 6, 74, 19, Msgs.Attr, true);
  45.     for J := 1 to I do FastWrite( DisplayLines[J], J+7, 5, Msgs.Attr);
  46.     end;
  47.  
  48. begin
  49. Continue := true;
  50. SetBG;
  51. clrscr;
  52. while Continue do
  53.    begin
  54.    AllowInput := true;
  55.    AllowControl := -1;      (* dis-allows control codes to be returned. *)
  56.    FastWrite( 'Name ?   (or HELP)  ', 1, 1, Msgs.Attr);
  57.    FindName := Strip( GetForm( 25, 1, 25, Strng(25,' '), '', AllowControl,
  58.                                AllowInput, Inputs.Attr, [#32..#126]));
  59.    SetBG;
  60.    I := ord(FindName[0]);
  61.    if (I > 0) and (I < FieldLen[1]) then
  62.       begin
  63.       FindName := UCase(FindName);
  64.       if FindName = 'HELP' then
  65.          NameSearchHelp
  66.         else
  67.          begin
  68.          FirstDisplay := FindInFile(FindName);
  69.          Continue := false;
  70.          end;
  71.       end
  72.      else
  73.       begin
  74.       FirstDisplay := 1;
  75.       Continue := false;
  76.       end;
  77.    end;
  78. end;
  79.  
  80. end.
  81.