Labelclass
A generic text label. Can be made editable.
Constructors2
Showing 2 constructors
No results match this filter.
Methods29
Showing 29 methods
protected void CaretSantity()
Ensure the text caret and selection are in sane positions, that is, not outside of the text bounds.
void—public virtual string GetClipboardValue(bool cut)
| Parameter | Type | Description |
|---|---|---|
| cut | bool | — |
string—public string GetSelectedText()
Returns the selected text.
string—public System.Collections.Generic.List`1<int> GetWordBoundaryIndices()
Returns a list of positions in the text of each side of each word within the `Sandbox.UI.Label.Text`. This is used for Control + Arrow Key navigation.
List<int>—public bool HasSelection()
bool—public void InsertText(string text, int pos, System.Nullable`1<int> endpos = null)
| Parameter | Type | Description |
|---|---|---|
| text | string | — |
| pos | int | — |
| endpos = null | Nullable<int> | — |
void—public virtual void LanguageChanged()
When the language changes, if we're token based we need to update to the new phrase.
void—public void MoveCaretLine(int offset_line, bool select)
Move the text caret to next or previous line.
| Parameter | Type | Description |
|---|---|---|
| offset_line | int | How many lines to offset. Negative values move up. |
| select | bool | Whether to also add the characters we passed by to the selection. |
void—public void MoveCaretPos(int delta, bool select = False)
Move the text caret by given amount.
| Parameter | Type | Description |
|---|---|---|
| delta | int | How many characters to the right to move. Negative values move left. |
| select = False | bool | Whether to also add the characters we passed by to the selection. |
void—public void MoveToLineEnd(bool select = False)
Move the text caret to the end of the current line.
| Parameter | Type | Description |
|---|---|---|
| select = False | bool | Whether to also add the characters we passed by to the selection. |
void—public void MoveToLineStart(bool select = False)
Move the text caret to the start of the current line.
| Parameter | Type | Description |
|---|---|---|
| select = False | bool | Whether to also add the characters we passed by to the selection. |
void—public void MoveToWordBoundaryLeft(bool select)
Move the text caret to the closest word start or end to the left of current position. This simulates holding Control key while pressing left arrow key.
| Parameter | Type | Description |
|---|---|---|
| select | bool | Whether to also add the characters we passed by to the selection. |
void—public void MoveToWordBoundaryRight(bool select)
Move the text caret to the closest word start or end to the right of current position. This simulates holding Control key while pressing right arrow key.
| Parameter | Type | Description |
|---|---|---|
| select | bool | Whether to also add the characters we passed by to the selection. |
void—protected virtual void OnClick(Sandbox.UI.MousePanelEvent e)
| Parameter | Type | Description |
|---|---|---|
| e | MousePanelEvent | — |
void—public virtual void OnDeleted()
void—public virtual void OnDraw()
void—protected virtual void OnMouseMove(Sandbox.UI.MousePanelEvent e)
| Parameter | Type | Description |
|---|---|---|
| e | MousePanelEvent | — |
void—public virtual void RemoveText(int start, int count)
Remove given amount of characters from the label at given `start` position.
| Parameter | Type | Description |
|---|---|---|
| start | int | — |
| count | int | — |
void—public void ReplaceSelection(string str)
Replace the currently selected text with given text.
| Parameter | Type | Description |
|---|---|---|
| str | string | — |
void—public void ScrollToCaret()
Put the caret within the visible region.
void—public void SelectWord(int wordPos)
Select a work at given word position.
| Parameter | Type | Description |
|---|---|---|
| wordPos | int | — |
void—public void SetCaretPosition(int pos, bool select = False)
Set the text caret position to the given index.
| Parameter | Type | Description |
|---|---|---|
| pos | int | Where to move the text caret to within the text. |
| select = False | bool | Whether to also add the characters we passed by to the selection. |
void—public virtual void SetContent(string value)
| Parameter | Type | Description |
|---|---|---|
| value | string | — |
void—public virtual void SetProperty(string name, string value)
| Parameter | Type | Description |
|---|---|---|
| name | string | — |
| value | string | — |
void—public void SetSelection(int start, int end)
Sets the text selection.
| Parameter | Type | Description |
|---|---|---|
| start | int | — |
| end | int | — |
void—No results match this filter.
Properties11
Showing 11 properties
public int Sandbox.UI.Label.CaretPosition { get; set; }
Position of the text cursor/caret within the text, at which newly typed characters are inserted.
int—public bool Sandbox.UI.Label.IsRich { get; set; }
Set to true if this is rich text. This means it can support some inline html elements.
bool—public bool Sandbox.UI.Label.Multiline { get; set; }
Enables multi-line support for editing purposes.
bool—public bool Sandbox.UI.Label.Selectable { get; set; }
Can be selected
bool—public Color Sandbox.UI.Label.SelectionColor { get; set; }
The color used for text selection highlight
public int Sandbox.UI.Label.SelectionEnd { get; set; }
int—public int Sandbox.UI.Label.SelectionStart { get; set; }
int—public bool Sandbox.UI.Label.ShouldDrawSelection { get; set; }
bool—public virtual string Sandbox.UI.Label.Text { get; set; }
Text to display on the label.
string—public int Sandbox.UI.Label.TextLength { get; set; }
Amount of characters in the text of the text entry. Not bytes.
int—public bool Sandbox.UI.Label.Tokenize { get; set; }
If true and the text starts with #, it will be treated as a language token.
bool—No results match this filter.