home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast.iso / pcmag / vol9n04.zip / USEHELLO.PAS < prev    next >
Pascal/Delphi Source File  |  1990-01-22  |  2KB  |  98 lines

  1. USEHELLO.PAS
  2.  
  3.  
  4. PROGRAM Use_Hello;
  5. (* Conditional compilation directives allow this
  6.    code to compile under _either_ TP5.5 or QP *)
  7.  
  8. {$IFDEF ver55}
  9.   {$DEFINE TP}
  10. {$ELSE}
  11.   {$IFDEF ver10}
  12.     {$DEFINE QP}
  13.   {$ELSE}
  14.     CRASH HERE -- neither Turbo nor Quick
  15.   {$ENDIF}
  16. {$ENDIF}
  17.  
  18. USES Crt,hello2;
  19. TYPE
  20.   MMpt = ^MovingMessage;
  21.   MovingMessage = OBJECT(ColorMessage)
  22.     width : Byte;
  23.     {$IFDEF TP}CONSTRUCTOR{$ELSE}PROCEDURE{$ENDIF}
  24.     InitMM(iS : String; iX, iY, iColor, iWid : Byte);
  25.     PROCEDURE Say; {$IFDEF TP}virtual;{$ELSE}override;{$ENDIF}
  26.   END;
  27.  
  28.   {$IFDEF TP}CONSTRUCTOR{$ELSE}PROCEDURE{$ENDIF}
  29.   MovingMessage.InitMM(iS : String; iX, iY, iColor, iWid : Byte);
  30.   BEGIN
  31.     {$IFDEF TP} ColorMessage.InitCM(iS, iX, iY, iColor);
  32.     {$ELSE}    self.InitCM(iS, iX, iY, iColor);
  33.     {$ENDIF}
  34.     self.width := iWid;
  35.   END;
  36.  
  37.   PROCEDURE MovingMessage.Say;
  38.   VAR marquee : String;
  39.     P : byte;
  40.   BEGIN
  41.     FillChar(marquee, SizeOf(marquee), ' ');
  42.     marquee[0] := chr(self.width);
  43.     P := 1;
  44.     self.SaveColor := TextAttr;
  45.     TextAttr := self.color;
  46.     REPEAT
  47.       GotoXY(self.X,self.Y);
  48.       Write(marquee);
  49.       MOVE(marquee[2], marquee[1],pred(self.width));
  50.       marquee[self.width] := self.words[P];
  51.       P := succ(P MOD length(self.words));
  52.       sound(250); Delay(5); NoSound;
  53.       delay(95);
  54.     UNTIL KeyPressed;
  55.     TextAttr := self.SaveColor;
  56.   END;
  57.  
  58. VAR
  59.   TheList : List;
  60. {$IFDEF QP}
  61.   tempMs : MsPt;
  62.   tempPM : PMpt;
  63.   tempCM : CMpt;
  64.   tempMM : MMpt;
  65. {$ENDIF}
  66.  
  67. BEGIN
  68.   ClrScr;
  69.   {$IFDEF QP} New(TheList); {$ENDIF}
  70.   TheList.Init;
  71. {$IFDEF TP}
  72.   TheList.Add(new(MMpt, InitMM('Dow Jones up 1000!  Film at 11.  ',
  73.                 10,15,$1C,60)));
  74.   TheList.Add(new(CMpt, InitCM('Hello in living color!',20,10,$4E)));
  75.   TheList.Add(new(PMpt, InitPM('Hello from down under',1,25)));
  76.   TheList.Add(new(MsPt, Init('Hello, World!')));
  77. {$ELSE}
  78.   New(tempMM); New(tempMM^);
  79.   tempMM^.InitMM('Dow Jones up 1000!  Film at 11.  ',10,15,$1C,60);
  80.   TheList.Add(TempMM);
  81.   New(tempCM); New(tempCM^);
  82.   tempCM^.InitCM('Hello in living color!',20,10,$4E);
  83.   TheList.Add(TempCM);
  84.   New(tempPM); New(tempPM^);
  85.   tempPM^.InitPM('Hello from down under',1,25);
  86.   TheList.Add(TempPM);
  87.   New(tempMs); New(tempMs^);
  88.   tempMs^.Init('Hello, World!');
  89.   TheList.Add(TempMs);
  90. {$ENDIF}
  91.   TheList.Show;
  92. END.
  93.  
  94.  
  95.  
  96.  
  97.  
  98.