Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 1.48 KB

TPJCustomConsoleApp-WindowPosition.md

File metadata and controls

50 lines (35 loc) · 1.48 KB

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.