home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / pas / swag / oop.swg / 0006_NUMVIEW.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  948b  |  55 lines

  1. Unit NumView;
  2.  
  3. Interface
  4.  
  5. Uses
  6.   Views, Objects, Drivers;
  7.  
  8. Type
  9.   PNumView = ^TNumView;
  10.   TNumView = Object(TView)
  11.   Number : LongInt;
  12.  
  13.   Constructor init(Var Bounds: Trect);
  14.   Procedure update(num:LongInt);
  15.   Procedure draw; Virtual;
  16.   Destructor done; Virtual;
  17.   end;
  18.  
  19. Implementation
  20.  
  21. {---------------------------}
  22. {                           }
  23. {     TNumView  Methods     }
  24. {                           }
  25. {---------------------------}
  26. Constructor TNumView.Init(Var Bounds: Trect);
  27. begin
  28.   inherited init(Bounds);
  29. end;
  30.  
  31. Procedure TNumView.Update(num:LongInt);
  32. begin
  33.   Number := num; Draw;
  34. end;
  35.  
  36. Procedure TNumView.Draw; Var
  37.   B: TDrawBuffer;
  38.   C: Word;
  39.   Display : String;
  40. begin
  41.   C := GetColor(6);
  42.   MoveChar(B, ' ', C, Size.X);
  43.   Str(Number,Display);
  44.   MoveStr(B, Display,C);
  45.   WriteLine(0, 0, Size.X,Length(Display), B);
  46. end;
  47.  
  48. Destructor TNumView.Done;
  49. begin
  50.   inherited done;
  51. end;
  52.  
  53. end.
  54.  
  55.