Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#1

TextColor für Delphi

  Alt 12. Dez 2005, 16:38
Hi,

Wenn man in Delphi eine Konsolenanwendung macht, dann programmiert man ja praktisch Pascal (wie auch mit VCL^^).
In TurboPascal kann man Text einfärben mit TextColor(Farbe). Den Befehl gibts in Delphi aber irgendwie nicht mehr...
Die ganzen Sachen mit TextColor etc steht in Turbo-Pascal in der Unit crt.
Ich wollte jetzt die Pascal Unit in ne Delphi Unit umwandeln um die Sachen wie TextColor nutzen zu können.
Die crt Unit sieht so aus:

Delphi-Quellcode:

{*******************************************************}
{                                                       }
{       Turbo Pascal Version 7.0                        }
{       CRT Interface Unit                              }
{                                                       }
{       Copyright (C) 1988,92 Borland International     }
{                                                       }
{*******************************************************}

unit Crt;

{$D-,I-,S-}

interface

const

{ CRT modes }

  BW40 = 0; { 40x25 B/W on Color Adapter }
  CO40 = 1; { 40x25 Color on Color Adapter }
  BW80 = 2; { 80x25 B/W on Color Adapter }
  CO80 = 3; { 80x25 Color on Color Adapter }
  Mono = 7; { 80x25 on Monochrome Adapter }
  Font8x8 = 256; { Add-in for ROM font }

{ Mode constants for 3.0 compatibility }

  C40 = CO40;
  C80 = CO80;

{ Foreground and background color constants }

  Black = 0;
  Blue = 1;
  Green = 2;
  Cyan = 3;
  Red = 4;
  Magenta = 5;
  Brown = 6;
  LightGray = 7;

{ Foreground color constants }

  DarkGray = 8;
  LightBlue = 9;
  LightGreen = 10;
  LightCyan = 11;
  LightRed = 12;
  LightMagenta = 13;
  Yellow = 14;
  White = 15;

{ Add-in for blinking }

  Blink = 128;

var

{ Interface variables }

  CheckBreak: Boolean; { Enable Ctrl-Break }
  CheckEOF: Boolean; { Enable Ctrl-Z }
  DirectVideo: Boolean; { Enable direct video addressing }
  CheckSnow: Boolean; { Enable snow filtering }
  LastMode: Word; { Current text mode }
  TextAttr: Byte; { Current text attribute }
  WindMin: Word; { Window upper left coordinates }
  WindMax: Word; { Window lower right coordinates }

{ Interface procedures }

procedure AssignCrt(var F: Text);
function KeyPressed: Boolean;
function ReadKey: Char;
procedure TextMode(Mode: Integer);
procedure Window(X1,Y1,X2,Y2: Byte);
procedure GotoXY(X,Y: Byte);
function WhereX: Byte;
function WhereY: Byte;
procedure ClrScr;
procedure ClrEol;
procedure InsLine;
procedure DelLine;
procedure TextColor(Color: Byte);
procedure TextBackground(Color: Byte);
procedure LowVideo;
procedure HighVideo;
procedure NormVideo;
procedure Delay(MS: Word);
procedure Sound(Hz: Word);
procedure NoSound;

// Komischweise fehlt hier das Folgende:
{
implemetation

end.
}
Naja das Problem ist: Wo sind die proceduren und Funktionen da bitte "ausgefüllt" ? -.-
Gar nicht. Aber woher weis Pascal was es tun soll ?
Und viel wichtiger: Woher bekomm ich die Funktionen/Proceduren ?

PS: Die Datei heißt: crt.int... wobei pascal immer tpu dateien zum einbinden braucht
Aber es gibt keine crt.tpu

Gruß
Michael
Michael
  Mit Zitat antworten Zitat