Description uses CRT

From Delphi Pascal wiki
Jump to navigation Jump to search

Description of procedures and functions CRT libraries.

ClrScr;

Clears the active window and places the cursor in the upper left corner of the screen.

Delay(Ms:Word);

Suspend the program for a specified number of milliseconds.

DelLine;

Deletes the line at the cursor position.

Gotoxy (X, Y: Byte);

Sets the cursor to the coordinates X, Y (X is the column Y is a row) in the active window.

HighVideo;

Sets a higher color intensity when viewing.

InsLine;

Inserts a blank line at the cursor position.

KeyPressed: Boolean;

Function answers the question "Was pressing a key on the keyboard?" Returns True if key was pressed, otherwise returns False.

{ Program wait for keyboard press and then finish }

Begin
   Repeat
   Until KeyPressed;
End.

LowVideo;

Sets the lower brightness when viewing.

NormVideo;

Sets the attributes of the original text read when the program starts at the cursor position.

NoSound;

Turns computer sound internal speaker if the procedure rozozvučaný Sound.

ReadKey: Char;

The function reads a character from the keyboard into a variable of type char. If the character is so loaded. gray keys (arrow keys, F1 .. F10, insert, home ..) ReadKey returns the # 0 After another phone call has returned to what key it is. Therefore, if we want to use as arrows, first check the character # 0, and after his arrival to test specific keys. The list of keys is attached.

  {The program will list what the arrow on the keyboard is pressed}

Begin
 WriteLn('Press the arrow');
 Repeat
   ch:=ReadKey;
   if (ch=#0) then begin { pressed gray key }
       if (ch=#75) then WriteLn('Left arrow');
       if (ch=#77) then WriteLn('Right arrow');
       if (ch=#72) then WriteLn('Up arrow');
       if (ch=#80) then WriteLn('Down arrow');
   end;
 Until (ch=#27);    { Press ESC to quit }
End.

Sound(Hz:Word);

Generates tone through the internal speaker. Hz is the frequency with which the speaker sound. The sound will continue as long as the order comes NoSound.

TextBackground (color: byte);

Sets the selected background color. The list of colors is attached.

TextColor (color: byte);

Sets the selected color feature that will print to the screen. The list of colors is attached.

WhereX: byte;

Funck returns the X-coordinate (column) relative to the left edge of the current window.

WhereY: byte;

The function returns the Y-coordinate (in line) relative to the top of the current window.

Window (X1, Y1, X2, Y2: Byte);

Defines a text box on the screen. The coordinates X1, Y1 are the upper left corner of the screen. X2, Y2 the lower right corner of the screen.


Where to go: Content | Work with text file