Torque 3D - Script Manual: GuiTextEditCtrl Class Reference

TorqueScript

Main   Class List   Namespace List   Online

GuiTextEditCtrl Class Reference
[General Controls]

A component that places a text entry box on the screen. More...

Inheritance diagram for GuiTextEditCtrl:

List of all members.

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.

Detailed Description

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.

Example:
   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.
   };
See also:
GuiTextCtrl
GuiControl

Member Function Documentation

void GuiTextEditCtrl::clearSelectedText (  ) 

Unselects all selected text in the control.

Example:
// Inform the control to unselect all of its selected text
%thisGuiTextEditCtrl.clearSelectedText();
See also:
GuiControl
void GuiTextEditCtrl::forceValidateText (  ) 

Force a validation to occur.

Example:
// Inform the control to force a validation of its text.
%thisGuiTextEditCtrl.forceValidateText();
See also:
GuiControl
int GuiTextEditCtrl::getCursorPos (  ) 

Returns the current position of the text cursor in the control.

Example:
// Acquire the cursor position in the control
%position = %thisGuiTextEditCtrl.getCursorPost();
Returns:
Text cursor position within the control.
See also:
GuiControl
string GuiTextEditCtrl::getText (  ) 

Acquires the current text displayed in this control.

Example:
// Acquire the value of the text control.
%text = %thisGuiTextEditCtrl.getText();
Returns:
The current text within the control.
See also:
GuiControl
bool GuiTextEditCtrl::isAllTextSelected (  ) 

Checks to see if all text in the control has been selected.

Example:
// Check to see if all text has been selected or not.
%allSelected = %thisGuiTextEditCtrl.isAllTextSelected();
Returns:
True if all text in the control is selected, otherwise false.
See also:
GuiControl
void GuiTextEditCtrl::onReturn (  ) 

Called when the 'Return' or 'Enter' key is pressed.

Example:
// Return or Enter key was pressed, causing the callback to occur.
GuiTextEditCtrl::onReturn(%this)
   {
      // Code to run when the onReturn callback occurs
   }
See also:
GuiTextCtrl
GuiControl
void GuiTextEditCtrl::onTabComplete ( string  val  ) 

Called if tabComplete is true, and the 'tab' key is pressed.

Parameters:
val Input to mimick the '1' sent by the actual tab key button press.
Example:
// Tab key has been pressed, causing the callback to occur.
GuiTextEditCtrl::onTabComplete(%this,%val)
   {
      //Code to run when the onTabComplete callback occurs
   }
See also:
GuiTextCtrl
GuiControl
void GuiTextEditCtrl::onValidate (  ) 

Called whenever the control is validated.

Example:
// The control gets validated, causing the callback to occur
GuiTextEditCtrl::onValidated(%this)
   {
      // Code to run when the control is validated
   }
See also:
GuiTextCtrl
GuiControl
void GuiTextEditCtrl::selectAllText (  ) 

Selects all text within the control.

Example:
// Inform the control to select all of its text.
%thisGuiTextEditCtrl.selectAllText();
See also:
GuiControl
void GuiTextEditCtrl::setCursorPos ( int  position  ) 

Sets the text cursor at the defined position within the control.

Parameters:
position Text position to set the text cursor.
Example:
// Define the cursor position
%position = "12";

// Inform the GuiTextEditCtrl control to place the text cursor at the defined position
%thisGuiTextEditCtrl.setCursorPos(%position);
See also:
GuiControl
void GuiTextEditCtrl::setText ( string  text  ) 

Sets the text in the control.

Parameters:
text Text to place in the control.
Example:
// Define the text to display
%text = "Text!"

// Inform the GuiTextEditCtrl to display the defined text
%thisGuiTextEditCtrl.setText(%text);
See also:
GuiControl

Reimplemented from GuiTextCtrl.


Member Data Documentation

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.

Script command to be called when the first validater is lost.



Copyright © GarageGames, LLC. All Rights Reserved.