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.

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.

Pos ObjectDescription
Function(Func<int>) Creates a Pos object that computes the position by executing the provided function. The function will be called every time the position is needed.
Percent(float) Creates a Pos object that is a percentage of the width or height of the SuperView.
AnchorEnd() 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.
Center() Creates a Pos object that can be used to center the View.
At(int) Creates a Pos object that is an absolute position based on the specified integer value.
Left(View) Creates a Pos object that tracks the Left (X) position of the specified View.
X(View) Creates a Pos object that tracks the Left (X) position of the specified View.
Top(View) Creates a Pos object that tracks the Top (Y) position of the specified View.
Y(View) Creates a Pos object that tracks the Top (Y) position of the specified View.
Right(View) Creates a Pos object that tracks the Right (X+Width) coordinate of the specified View.
Bottom(View) Creates a Pos object that tracks the Bottom (Y+Height) coordinate of the specified View

Methods

AnchorEnd()

Creates a Pos object that is anchored to the end (right side or bottom) of the SuperView, minus the respective dimension of the View. This is equivalent to using AnchorEnd(int), with an offset equivalent to the View's respective dimension.

AnchorEnd(int)

Creates a Pos object that is anchored to the end (right side or bottom) of the SuperView, useful to flush the layout from the right or bottom. See also AnchorEnd(), which uses the view dimension to ensure the view is fully visible.

At(int)

Creates a Pos object that is an absolute position based on the specified integer value.

Bottom(View)

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

Center()

Creates 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 Pos object that computes the position by executing the provided function. The function will be called every time the position is needed.

GetHashCode()

Serves as the default hash function.

Left(View)

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

Percent(float)

Creates a percentage Pos object

Right(View)

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

Top(View)

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

X(View)

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

Y(View)

Creates a Pos object that 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.