Unigine.WidgetEditText Class
Inherits from: | Widget |
This class creates a simple editable multi-line text area containing text strings.
See Also#
- Widgets sample in C# Component Samples suite
- UnigineScript API sample <UnigineSDK>/data/samples/widgets/text_00
WidgetEditText Class
Properties
string Text#
The contents of the text field.
int NumLines#
The number of lines in the text field.
int SelectionLine#
The number of the line where selection starts.
int SelectionPosition#
The cursor position in the line where selection starts.
int CursorLine#
The number of the current line.
int CursorPosition#
The cursor position in the current line.
vec4 NumberColor#
The color used for numbers.
vec4 SelectionColor#
The color used to highlight the selection for the widget.
vec4 BackgroundColor#
The background color for the widget.
int Background#
The value indicating if a background texture is rendered for the text field. The default is 1.
bool Editable#
The value indicating if the contents of the text field can be edited. The default is value is true.
int CursorPositionX#
The value of the text cursor position X coordinate.
int CursorPositionY#
The value of the text cursor position Y coordinate.
int CursorWidth#
The text cursor width.
bool UseScrollWheelEnabled#
The value indicating if the currently selected line is changed (the cursor moves up or down) when scrolling the mouse wheel.
string StyleTextureBackground#
The path to the texture to be used as a background of the widget.
string StyleTextureSelection#
The path to the texture to be used as a background for the selected text.
Members
WidgetEditText ( Gui gui, string str = 0 ) #
Constructor. Creates a multiline text field and adds it to the specified GUI.Arguments
- Gui gui - GUI, to which the text field will belong.
- string str - Initial value. This is an optional parameter.
WidgetEditText ( string str = 0 ) #
Constructor. Creates a multiline text field and adds it to the Engine GUI.Arguments
- string str - Initial value. This is an optional parameter.
void SetCursor ( int position, int line ) #
Sets the cursor to a given position in a given line.Arguments
- int position - Position number.
- int line - Line number.
void SetLineText ( int line, string str ) #
Sets new contents for a given line.Arguments
- int line - Line number.
- string str - Text.
string GetLineText ( int line ) #
Returns the text contained in a given line.Arguments
- int line - Line number.
Return value
Text contained in the line.void SetSelection ( int position, int line ) #
Sets a line and a position from which a new selection will start.Arguments
- int position - Position number.
- int line - Line number.
string GetSelectionText ( ) #
Returns the currently selected text.Return value
Currently selected text.void SetTokenColor ( string token, vec4 color ) #
Sets a color for a given token. The token will be highlighted with the provided color.Arguments
- string token - Token (i.e. keyword, identifier, etc).
- vec4 color - Color.
vec4 GetTokenColor ( string token ) #
Returns a color, which is used to highlight a given token.Arguments
- string token - Token.
Return value
Color of the current token.void SetTokensColor ( string tokens, vec4 color ) #
Sets a color to given tokens. Each token will be highlighted with the provided color.Arguments
- string tokens - Comma-separated list of tokens (i.e. keywords, identifiers, etc).
- vec4 color - Color.
int AddLine ( string str = 0 ) #
Adds a new line to the widget.Arguments
- string str - Text to add. This is an optional argument.
Return value
Number of the added line.void ClearSelectionText ( ) #
Deletes the currently selected text.void RemoveLine ( int line ) #
Deletes a given line.Arguments
- int line - Line number.
int GetLineWidth ( int line, int end = -1 ) #
Returns the text line width (space taken by symbols).Arguments
- int line - The line index from 0 to the total number of lines.
- int end - The index of the last symbol up to which the line width is returned. If set to -1, the whole set of symbols in the line is taken.
Return value
The text line width, in pixels.Last update:
2024-07-12
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)