home *** CD-ROM | disk | FTP | other *** search
- (* ------------------------------------------------------ *)
- (* ATTRDEMO.PAS *)
- (* Demo-Programm für die Möglichkeiten *)
- (* von ATTRIBUT.PAS *)
- (* ------------------------------------------------------ *)
- PROGRAM AttributDemo;
-
- USES Crt, Dos, Attribut;
-
- VAR
- x, y, v, h, at : BYTE;
- ca, Result, i : INTEGER;
- Vs, hs : STRING;
- ch1, ch : CHAR;
- GrauSchwarz, GelbRot : BYTE;
-
- CONST
- Rand : ARRAY[1..8] OF CHAR
- = ('┌','─','┐','│','│','└','─','┘');
- Schatten : BOOLEAN = FALSE;
-
-
- PROCEDURE Rahmen(x1, y1, x2, y2 : BYTE);
- BEGIN
- Window(x1, y1, x2, y2); ClrScr;
- Window(1, 1, 80, 25);
- WrtChr(x1, y1, Rand[1]); WrtChr(x2, y1, Rand[ 3]);
- FillChr(Succ(x1), y1, Pred(x2), y1, Rand[2]);
- FillChr(Succ(x1), y2, Pred(x2), y2, Rand[7]);
- FillChr(x1, Succ(y1), x1, Pred(y2), Rand[4]);
- FillChr(x2, Succ(y1), x2, Pred(y2), Rand[5]);
- WrtChr(x1, y2, Rand[6]); WrtChr(x2, y2, Rand[8])
- END;
-
- PROCEDURE Fahne;
- BEGIN
- FillAttr(1, 3, 24, 4, MakeAttr(Black, Black));
- FillAttr(1, 5, 24, 6, MakeAttr(LightRed, Black));
- FillAttr(1, 7, 24, 8, MakeAttr(Yellow, Black));
- END;
-
- PROCEDURE BildschirmAufbau;
- BEGIN
- Desktop(178, MakeAttr(White, Black));
- WrtStr(28, 1, ' Attribute Demonstration ');
- Window(25, 3, 75, 22);
- FOR i := 1 TO 40 DO Write('Text-Hintergrund Toolbox ');
- Write('Text-Hintergrund To');
- WrtChr(75, 22, 'l');
- FillAttr(25, 3, 75, 22, MakeAttr(White, LightGray));
- Rahmen(1, 15, 24, 22);
- Window(2, 16, 23, 21);
- FOR i := 1 TO 26 DO Write('Test ');
- Rahmen(31, 8, 70, 20);
- WrtStr(37, 10, '<1> Schatten An/Aus');
- WrtStr(37, 12, '<2> Blinken An/Aus');
- WrtStr(37, 14, '<3> Attribut-Auswahl');
- WrtStr(60, 18, 'ESC: Ende');
- WrtStr(32, 18, 'Wahl: ');
- FillAttr(31, 8, 70, 20, MakeAttr(LightGray, Blue));
- Fahne; ca := 1;
- WrtStr(53, 25, '(c) 89 L.Holländer & TOOLBOX');
- WrtStr(1, 25, 'Vordergrund: Hintergrund: ' +
- ' Attribut: ');
- END;
-
- PROCEDURE TestColor;
- VAR
- Regs : Registers;
- BEGIN
- Regs.ah := 15;
- Intr($10, Regs);
- IF (Regs.al = 7) THEN BEGIN
- Write('Keine Color-Grafik-Karte');
- Halt(0);
- END;
- END;
-
- BEGIN
- TestColor;
- TextAttr := 15; ClrScr;
- GelbRot := MakeAttr(Yellow, Red);
- GrauSchwarz := MakeAttr(LightGray, Black);
- BildschirmAufbau;
- REPEAT
- GotoXY(38,18); ch := ReadKey;
- IF ch = #0 THEN ch := ReadKey;
- Write(ch);
- FillAttr(37, 8+ca*2, 56, 8+ca*2,
- MakeAttr(LightGray, Blue));
- CASE ch OF
- '1': BEGIN
- Schatten := NOT(Schatten);
- FillAttr(37, 10, 56, 10, GelbRot);
- IF Schatten THEN BEGIN
- FillAttr(71, 9, 71, 21, GrauSchwarz);
- FillAttr(32, 21, 70, 21, GrauSchwarz);
- END ELSE BEGIN
- FillAttr(71, 9, 71, 21,
- MakeAttr(White, LightGray));
- FillAttr(32, 21, 70, 21,
- MakeAttr(White, LightGray));
- END;
- END;
- '2': BEGIN
- FillAttr(60, 18, 69, 18,
- PickAttr(60, 18) + Blink);
- FillAttr(37, 12, 56, 12, GelbRot);
- END;
- '3': BEGIN
- FillAttr(37, 14, 56, 14, GelbRot);
- GotoXY(13, 25); ch1 := UpCase(ReadKey);
- Vs := '$' + ch1;
- Val(Vs, v, Result);
- IF Result > 0 THEN Write(^G'$0')
- ELSE Write(Vs);
- GotoXY(31, 25); ch1 := ReadKey;
- hs := '$' + ch1;
- Val(hs, h, Result);
- IF Result > 0 THEN h := 0;
- Write('$', h MOD 8);
- FillAttr(2, 16, 23, 21, MakeAttr(v, h));
- GotoXY(46, 25); Write(MakeAttr(v, h) : 3);
- END;
- ELSE
- IF ch <> #27 THEN Write(^G);
- END;
- Val(ch, ca, Result);
- IF ca > 3 THEN ca := 3; IF ca < 1 THEN ca := 1;
- UNTIL ch = #27;
- ClrScr;
- END.
- (* ------------------------------------------------------ *)
- (* Ende von ATTRDEMO.PAS *)