Table of Contents

Class Pos

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Describes the position of a View which can be an absolute value, a percentage, centered, or relative to the ending dimension. Integer values are implicitly convertible to an absolute Pos. These objects are created using the static methods Percent, AnchorEnd, and Center. The Pos objects can be combined with the addition and subtraction operators.

public class Pos
Inheritance
Pos
Inherited Members

Remarks

Use the Pos objects on the X or Y properties of a view to control the position.

These can be used to set the absolute position, when merely assigning an integer value (via the implicit integer to Pos conversion), and they can be combined to produce more useful layouts, like: Pos.Center - 3, which would shift the position of the View 3 characters to the left after centering for example.

It is possible to reference coordinates of another view by using the methods Left(View), Right(View), Bottom(View), Top(View). The X(View) and Y(View) are aliases to Left(View) and Top(View) respectively.

Methods

AnchorEnd(int)

Creates a Pos object that is anchored to the end (right side or bottom) of the dimension, useful to flush the layout from the right or bottom.

At(int)

Creates an Absolute Pos from the specified integer value.

Bottom(View)

Returns a Pos object tracks the Bottom (Y+Height) coordinate of the specified View

Center()

Returns a Pos object that can be used to center the View

Equals(object)

Determines whether the specified object is equal to the current object.

Function(Func<int>)

Creates a "PosFunc" from the specified function.

GetHashCode()

Serves as the default hash function.

Left(View)

Returns a Pos object tracks the Left (X) position of the specified View.

Percent(float)

Creates a percentage Pos object

Right(View)

Returns a Pos object tracks the Right (X+Width) coordinate of the specified View.

Top(View)

Returns a Pos object tracks the Top (Y) position of the specified View.

X(View)

Returns a Pos object tracks the Left (X) position of the specified View.

Y(View)

Returns a Pos object tracks the Top (Y) position of the specified View.

Operators

operator +(Pos, Pos)

Adds a Pos to a Pos, yielding a new Pos.

implicit operator Pos(int)

Creates an Absolute Pos from the specified integer value.

operator -(Pos, Pos)

Subtracts a Pos from a Pos, yielding a new Pos.