TextMode
Jump to navigation
Jump to search
Selects a specific text mode.
- Declaration
procedure TextMode(Mode: Integer);
- Target
- Real, Protected
- Remarks
- When TextMode is called, the current window is reset to the entire screen, DirectVideo is set to True, CheckSnow is set to True if a color mode was selected, the current text attribute is reset to normal corresponding to a call to NormVideo, and the current video is stored in LastMode. In addition, LastMode is initialized at program startup to the then-active video mode.
- Specifying TextMode(LastMode) causes the last active text mode to be re-selected. This is useful when you want to return to text mode after using a graphics package, such as Graph or Graph3.
- The following call to TextMode
TextMode(C80 + Font8x8)
- will reset the display into 43 lines and 80 columns on an EGA, or 50 lines and 80 columns on a VGA with a color monitor. TextMode(Lo(LastMode)) always turns off 43- or 50-line mode and resets the display (although it leaves the video mode unchanged), while
TextMode(Lo(LastMode) + Font8x8)
- will keep the video mode the same, but reset the display into 43 or 50 lines.
- If your system is in 43- or 50-line mode when you load a program, the mode will be preserved by the Crt startup code, and the window variable that keeps track of the maximum number of lines on the screen (WindMax) will be initialized correctly.
- Here's how to write a "well-behaved" program that will restore the video mode to its original state:
program Video; uses Crt; var OrigMode: Integer; begin OrigMode := LastMode; _{ Remember original mode } ... TextMode(OrigMode); end.
- Sample Code
{TxtMd.PAS} { Example for TextMode } program Video; { Switch color monitor to 40 columns and back. Won't work on mono adapter. } uses Crt; var OrigMode: Integer; begin OrigMode := LastMode; TextMode(CO40); WriteLn('Big Characters'); ReadLn; TextMode(OrigMode); end.