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.

WindowPosition property

Project: Console Application Runner Classes

Unit: PJConsoleApp

Classes: TPJCustomConsoleApp, TPJConsoleApp

Applies to: ~>3.0

property WindowPosition: TPoint;

Description

This property specifies the co-ordinates of the top left corner of a console application’s window, in pixels. If either co-ordinate is negative then the default window position is used.

The property defaults to (-1, -1).

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 TPoint record containing the required position information and then assigning the record to the property. For example:

var
  Pt: TPoint;
  App: TPJConsoleApp;
begin
  // assume App contains a valid TPJConsoleApp instance
  Pt.X := 200;
  Pt.Y := 400;
  App.WindowPosition := Pt;
end;

Use of the VCL’s Point routine makes 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.WindowPosition := Point(200, 400);
end;

The property is public in TPJConsoleApp and protected in TPJCustomConsoleApp.