TextBox

A component that turns a Widget into a single or multiple text input box. Based on the TextBoxType specified the textbox input can be restricted to only handle letters or numbers.

See Also

Static Variables


Name Description
widget Parent Widget where the TextBox component is defined.
font Reference to the Font to use when drawing the TextBox.
textbuffer Total amount of characters currently cached.
size Size of the string in pixels based on the current Font used by the TextBox.

Variables


Name Description
selection The current text selection represented by the character index where the selection begin (X component) and the end index (Y component).
margin Specify the margin to use when drawing the TextBox.
centered Determine if the string of the TextBox should be centered.
read_only Enable or disable the text input to be read-only.
max_char Maximum of characters allowed to input.
string Current text set for the TextBox.

Functions


Name Description
SetTextBuffer Helper that return the Label alignment size in pixels taking in consideration if its margin and centered state.
InsertChar Insert a character at the current selection.
InsertString Insert a string of text at the current TextBuffer selection.
GetCharIndex Retrieve the nearest character index at a position specified in window space.
GetCharPosition Retrieve the 2D coordinates of a specific character.
GetSelectedString Retrieve the current selected string in the TextBuffer.
AdjustScroll Adjust the TextBox scroll based on its associated TextBuffer selection.
SetValue Helper that converts a value to a string.
GetValue Helper that conver the current TextBox string back to a floating point number.

TextBoxType


Constant value that defines the sub-type of the TextBox. Based on this type the TextBox insertion methods will be affected.

  • kAscii: Only allow letters.
  • kNumeric: Only allow numbers.
  • kAlphaNumeric: Allow only a combination of letters and numbers.
  • kVariable: Only allow characters that can be used to form a variable name.




NRG - API 2022.4.384543 - Fri Nov 4 2022
Copyright © 2022 nrgcore.com. All Rights Reserved. Terms of Service - Privacy Policy - EULA