|
A component that places a text entry box on the screen. More...
Public Member Functions | |
void | clearSelectedText () |
Unselects all selected text in the control. | |
void | forceValidateText () |
Force a validation to occur. | |
int | getCursorPos () |
Returns the current position of the text cursor in the control. | |
string | getText () |
Acquires the current text displayed in this control. | |
bool | isAllTextSelected () |
Checks to see if all text in the control has been selected. | |
void | selectAllText () |
Selects all text within the control. | |
void | setCursorPos (int position) |
Sets the text cursor at the defined position within the control. | |
void | setText (string text) |
Sets the text in the control. | |
Callbacks | |
void | onReturn () |
Called when the 'Return' or 'Enter' key is pressed. | |
void | onTabComplete (string val) |
Called if tabComplete is true, and the 'tab' key is pressed. | |
void | onValidate () |
Called whenever the control is validated. | |
Public Attributes | |
Text Input | |
SFXTrack | deniedSound |
If the attempted text cannot be entered, this sound effect will be played. | |
string | escapeCommand |
Script command to be called when the Escape key is pressed. | |
int | historySize |
How large of a history buffer to maintain. | |
bool | password |
If true, all characters entered will be stored in the control, however will display as the character stored in passwordMask. | |
string | passwordMask |
If 'password' is true, this is the character that will be used to mask the characters in the control. | |
bool | sinkAllKeyEvents |
If true, every key event will act as if the Enter key was pressed. | |
bool | tabComplete |
If true, when the 'tab' key is pressed, it will act as if the Enter key was pressed on the control. | |
string | validate |
Script command to be called when the first validater is lost. |
A component that places a text entry box on the screen.
Fonts and sizes are changed using profiles. The text value can be set or entered by a user.
new GuiTextEditCtrl(MessageHud_Edit) { text = "Hello World"; validate = "validateCommand();" escapeCommand = "escapeCommand();"; historySize = "5"; tabComplete = "true"; deniedSound = "DeniedSoundProfile"; sinkAllKeyEvents = "true"; password = "true"; passwordMask = "*"; //Properties not specific to this control have been omitted from this example. };
void GuiTextEditCtrl::clearSelectedText | ( | ) |
Unselects all selected text in the control.
// Inform the control to unselect all of its selected text
%thisGuiTextEditCtrl.clearSelectedText();
void GuiTextEditCtrl::forceValidateText | ( | ) |
Force a validation to occur.
// Inform the control to force a validation of its text.
%thisGuiTextEditCtrl.forceValidateText();
int GuiTextEditCtrl::getCursorPos | ( | ) |
Returns the current position of the text cursor in the control.
// Acquire the cursor position in the control %position = %thisGuiTextEditCtrl.getCursorPost();
string GuiTextEditCtrl::getText | ( | ) |
Acquires the current text displayed in this control.
// Acquire the value of the text control. %text = %thisGuiTextEditCtrl.getText();
bool GuiTextEditCtrl::isAllTextSelected | ( | ) |
Checks to see if all text in the control has been selected.
// Check to see if all text has been selected or not.
%allSelected = %thisGuiTextEditCtrl.isAllTextSelected();
void GuiTextEditCtrl::onReturn | ( | ) |
Called when the 'Return' or 'Enter' key is pressed.
// Return or Enter key was pressed, causing the callback to occur. GuiTextEditCtrl::onReturn(%this) { // Code to run when the onReturn callback occurs }
void GuiTextEditCtrl::onTabComplete | ( | string | val | ) |
Called if tabComplete is true, and the 'tab' key is pressed.
val | Input to mimick the '1' sent by the actual tab key button press. |
// Tab key has been pressed, causing the callback to occur. GuiTextEditCtrl::onTabComplete(%this,%val) { //Code to run when the onTabComplete callback occurs }
void GuiTextEditCtrl::onValidate | ( | ) |
Called whenever the control is validated.
// The control gets validated, causing the callback to occur GuiTextEditCtrl::onValidated(%this) { // Code to run when the control is validated }
void GuiTextEditCtrl::selectAllText | ( | ) |
Selects all text within the control.
// Inform the control to select all of its text.
%thisGuiTextEditCtrl.selectAllText();
void GuiTextEditCtrl::setCursorPos | ( | int | position | ) |
Sets the text cursor at the defined position within the control.
position | Text position to set the text cursor. |
void GuiTextEditCtrl::setText | ( | string | text | ) |
Sets the text in the control.
text | Text to place in the control. |
Reimplemented from GuiTextCtrl.
If the attempted text cannot be entered, this sound effect will be played.
Script command to be called when the Escape key is pressed.
How large of a history buffer to maintain.
If true, all characters entered will be stored in the control, however will display as the character stored in passwordMask.
If 'password' is true, this is the character that will be used to mask the characters in the control.
If true, every key event will act as if the Enter key was pressed.
If true, when the 'tab' key is pressed, it will act as if the Enter key was pressed on the control.
string GuiTextEditCtrl::validate |
Script command to be called when the first validater is lost.