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

  1. program DemoList7;
  2. {demls6 - creating a descendant ListObject}
  3.  
  4. Uses DOS, CRT,
  5.      totFAST, totLINK, totLIST, totSTR, totMSG;
  6.  
  7. Type
  8.   NewListLinkOBJ = object (ListLinkOBJ)
  9.      {Methods...}
  10.      constructor Init;
  11.      function    MessageTask(HiPick:longint):string;             VIRTUAL;
  12.      destructor  Done;                                           VIRTUAL;
  13.   end; {NewListLinkOBJ}
  14.  
  15. Var
  16.    ListWin:  NewListLinkObj;
  17.    ItemList: StrDLLOBJ;
  18.    FileOK: boolean;
  19. {+++++new object methods+++++}
  20. constructor NewListLinkOBJ.Init;
  21. {}
  22. begin
  23.    ListLinkOBJ.Init;
  24.    vMsgActive := true;
  25. end; {NewListLinkOBJ.Init}
  26.  
  27. function  NewListLinkOBJ.MessageTask(HiPick:longint):string;
  28. {}
  29. begin
  30.    MessageTask := 'The Hi Pick is '+IntToStr(HiPick);
  31. end; {NewListLinkOBJ.MessageTask}
  32.  
  33. destructor NewListLinkOBJ.Done;
  34. {}
  35. begin
  36.    ListLinkOBJ.Done;
  37. end; {NewListLinkOBJ.Done}
  38. {+++++end of new object methods+++++}
  39.  
  40. procedure LoadLinkedList;
  41. {}
  42. var 
  43.   F: text;
  44.   Line:string;
  45.   Result: integer;
  46. begin
  47.    with ItemList do
  48.    begin
  49.       Init;
  50.       {$I-}
  51.       Assign(F,'demls4.txt');
  52.       Reset(F);
  53.       {$I+}
  54.       FileOK := (IOResult = 0);
  55.       if not FileOK then
  56.          Result := Add('File not found')
  57.       else
  58.       begin
  59.          while not eof(F) do
  60.          begin
  61.             Readln(F,Line);
  62.             Result := Add(Line);
  63.          end;
  64.          close(F);
  65.       end;
  66.    end;
  67. end; {LoadLinkedList}
  68.  
  69. begin
  70.    Screen.Clear(white,'░'); {paint the screen}
  71.    LoadLinkedList;
  72.    with ListWin do
  73.    begin
  74.       Init;
  75.       AssignList(ItemList);
  76.       SetColWidth(15);
  77.       Win^.SetTitle(' A List With Messages ');
  78.       Win^.SetSize(20,5,60,20,2);
  79.       Win^.SetMinSize(20,7);
  80.       if not FileOk then
  81.          SetTagging(false);
  82.       Go;
  83.       Done;
  84.    end;
  85.    ItemList.Done;
  86. end.
  87.