Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

ScreenBufferSize property

Project: Console Application Runner Classes

Unit: PJConsoleApp

Classes: TPJCustomConsoleApp, TPJConsoleApp

Applies to: ~>3.0

property ScreenBufferSize: TSize;

Description

Specifies the size of a console’s screen buffer in character columns and rows. If either dimension is zero or negative the default buffer size is used.

The property defaults to (0, 0).

Remarks

If a console application shares a console this property has no effect. See UseNewConsole for more information about shared consoles.

The individual fields of the property are read-only so the property must be set by first creating a TSize record containing the required buffer size information and then assigning the record to the property. For example:

var
  Size: TSize;
  App: TPJConsoleApp;
begin
  // assume App contains a valid TPJConsoleApp instance
  Size.cx := 120;  // 120 columns
  Size.cy := 300;  // 300 rows
  App.ScreenBufferSize := Size;
end;

The MakeSize routine has been provided to make this process easier. The following code has the same effect as the above:

var
  App: TPJConsoleApp;
begin
  // assume App contains a valid TPJConsoleApp instance
  App.ScreenBufferSize := MakeSize(120, 300);
end;

The property is public in TPJConsoleApp and protected in TPJCustomConsoleApp.