Table of Contents

Class GuiElementEditableTextBase

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll
public abstract class GuiElementEditableTextBase : GuiElementTextBase, IDisposable
Inheritance
GuiElementEditableTextBase
Implements
Derived
Inherited Members

Constructors

GuiElementEditableTextBase(ICoreClientAPI, CairoFont, ElementBounds)

Initializes the text component.

public GuiElementEditableTextBase(ICoreClientAPI capi, CairoFont font, ElementBounds bounds)

Parameters

capi ICoreClientAPI

The Client API

font CairoFont

The font of the text.

bounds ElementBounds

The bounds of the component.

Fields

OnCaretPositionChanged

public Action<int, int> OnCaretPositionChanged

Field Value

Action<int, int>

OnCursorMoved

public Action<double, double> OnCursorMoved

Field Value

Action<double, double>

OnKeyPressed

Called when a keyboard key was pressed, received and handled

public Action OnKeyPressed

Field Value

Action

OnTextChanged

public Action<string> OnTextChanged

Field Value

Action<string>

OnTryTextChangeText

public GuiElementEditableTextBase.OnTryTextChangeDelegate OnTryTextChangeText

Field Value

GuiElementEditableTextBase.OnTryTextChangeDelegate

WordWrap

public bool WordWrap

Field Value

bool

lines

protected List<string> lines

Field Value

List<string>

linesStaging

Contains the same as Lines, but may momentarily have different values when an edit is being made

protected List<string> linesStaging

Field Value

List<string>

pcaretPosInLine

protected int pcaretPosInLine

Field Value

int

pcaretPosLine

protected int pcaretPosLine

Field Value

int

Properties

CaretPosInLine

public int CaretPosInLine { get; set; }

Property Value

int

CaretPosLine

public int CaretPosLine { get; set; }

Property Value

int

CaretPosWithoutLineBreaks

public int CaretPosWithoutLineBreaks { get; set; }

Property Value

int

Focusable

Whether or not the element can be focused.

public override bool Focusable { get; }

Property Value

bool

TextLengthWithoutLineBreaks

public int TextLengthWithoutLineBreaks { get; }

Property Value

int

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public override void Dispose()

GetLines()

public List<string> GetLines()

Returns

List<string>

GetText()

Gets the text on the element.

public override string GetText()

Returns

string

The text of the element.

Lineize(string)

public List<string> Lineize(string text)

Parameters

text string

Returns

List<string>

LoadValue(List<string>)

Sets given texts, leaves cursor position unchanged

public void LoadValue(List<string> newLines)

Parameters

newLines List<string>

MoveCursor(int, bool)

Moves the cursor forward and backward by an amount.

public void MoveCursor(int dir, bool wholeWord = false)

Parameters

dir int

The direction to move the cursor.

wholeWord bool

Whether or not we skip entire words moving it.

OnFocusGained()

The event fired when the element gains focus.

public override void OnFocusGained()

OnFocusLost()

The event fired when the element looses focus.

public override void OnFocusLost()

OnKeyDown(ICoreClientAPI, KeyEvent)

The event fired when a key is held down.

public override void OnKeyDown(ICoreClientAPI api, KeyEvent args)

Parameters

api ICoreClientAPI

The client API

args KeyEvent

The key event arguments.

OnKeyPress(ICoreClientAPI, KeyEvent)

The event fired the moment a key is pressed.

public override void OnKeyPress(ICoreClientAPI api, KeyEvent args)

Parameters

api ICoreClientAPI

The Client API.

args KeyEvent

The keyboard state when the key was pressed.

OnMouseDownOnElement(ICoreClientAPI, MouseEvent)

The event fired when the mouse is pressed while on the element. Called after OnMouseDown and tells the engine that the event is handled.

public override void OnMouseDownOnElement(ICoreClientAPI api, MouseEvent args)

Parameters

api ICoreClientAPI

The Client API

args MouseEvent

The mouse event args.

RenderInteractiveElements(float)

Renders the element as an interactive element.

public override void RenderInteractiveElements(float deltaTime)

Parameters

deltaTime float

The change in time.

SetCaretPos(double, double)

Sets the position of the cursor at a given point.

public void SetCaretPos(double x, double y)

Parameters

x double

X position of the cursor.

y double

Y position of the cursor.

SetCaretPos(int, int)

Sets the position of the cursor to a specific character.

public void SetCaretPos(int posInLine, int posLine = 0)

Parameters

posInLine int

The position in the line.

posLine int

The line of the text.

SetMaxHeight(int)

public void SetMaxHeight(int maxheight)

Parameters

maxheight int

SetMaxLines(int)

Sets the number of lines in the Text Area.

public void SetMaxLines(int maxlines)

Parameters

maxlines int

The maximum number of lines.

SetValue(float)

Sets a numerical value to the text, appending it to the end of the text.

public void SetValue(float value)

Parameters

value float

The value to add to the text.

SetValue(string, bool)

Sets given text, sets the cursor to the end of the text

public void SetValue(string text, bool setCaretPosToEnd = true)

Parameters

text string
setCaretPosToEnd bool