home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / tot5.zip / EXTDEM5.PAS < prev    next >
Pascal/Delphi Source File  |  1991-02-11  |  2KB  |  67 lines

  1. Program ExtendedDemoFive;
  2. {EXTDEM5 - this program shows how to use the
  3.            RecordListOBJ object from the extLINK unit.
  4.  
  5.            In this example, the information is stored
  6.            in a sequential file. In real life, it
  7.            would often be a database.}
  8.  
  9.  
  10. Uses DOS,CRT,
  11.      totFAST, totINPUT, totIO2, totLIST, extLINK, totSTR, totLINK;
  12.  
  13. var
  14.   RecList: RecordDLLOBJ;
  15.   ListWin: BrowseLinkOBJ;
  16.  
  17. procedure BuildTheList(Filename:string);
  18. {loads in the data from disk - could also be from d/b}
  19. var 
  20.   F: file of RecordInfo;
  21.   Rec: RecordInfo;
  22.   Ecode: integer;
  23. begin
  24.    assign(F,filename);
  25.    {$I-}
  26.    reset(F);
  27.    {$I+}
  28.    if ioresult <> 0 then
  29.    begin
  30.       writeln('The file ',filename,' cannot be located.');
  31.       writeln('Demo aborting. Run demo from directory containing file.');
  32.       halt(1);
  33.    end;
  34.    Ecode := 0;
  35.    RecList.Init;
  36.    while not eof(F) and (Ecode = 0) do
  37.    begin
  38.       Read(F,Rec);
  39.       with Rec do
  40.       begin
  41.          FirstName:= padleft(FirstName,15,' ');
  42.          LastName:= padleft(LastName,15,' ');
  43.          Company:= padleft(Company,20,' ');
  44.       end;
  45.       Ecode := RecList.Add(Rec);
  46.    end;
  47.    close(F);
  48. end; {BuildtheList}
  49.  
  50. begin {Main program}
  51.    BuildTheList('EXTDEM5.DBF');
  52.    Screen.Clear(white,'░'); {paint the screen}
  53.    Key.SetFast;
  54.    with FMTNumberTOT do
  55.    begin
  56.       SetJustification(JustRight);
  57.       SetPrefixSuffix('$','');
  58.    end;
  59.    with ListWin do
  60.    begin
  61.       Init;
  62.       Win^.SetTitle(' Total Records: '+inttostr(RecList.TotalNodes)+' ');
  63.       AssignList(RecList);
  64.       Go;
  65.    end;
  66. end.
  67.