|
A text control that uses the Gui Markup Language ('ML') tags to dynamically change the text. More...
Public Member Functions | |
void | addText (string text, bool reformat) |
Appends the text in the control with additional text. Also . | |
void | forceReflow () |
Forces the text control to reflow the text after new text is added, possibly resizing the control. | |
string | getText () |
Returns the text from the control, including TorqueML characters. | |
void | scrollToBottom () |
Scroll to the bottom of the text. | |
void | scrollToTag (int tagID) |
Scroll down to a specified tag. | |
void | scrollToTop (int param1, int param2) |
Scroll to the top of the text. | |
void | setAlpha (float alphaVal) |
Sets the alpha value of the control. | |
bool | setCursorPosition (int newPos) |
Change the text cursor's position to a new defined offset within the text in the control. | |
void | setText (string text) |
Set the text contained in the control. | |
Callbacks | |
void | onResize (string width, string maxY) |
Called whenever the control size changes. | |
void | onURL (string url) |
Called whenever a URL was clicked on within the control. | |
Public Attributes | |
Text | |
bool | allowColorChars |
If true, the control will allow characters to have unique colors. | |
SFXTrack | deniedSound |
If the text will not fit in the control, the deniedSound is played. | |
int | lineSpacing |
The number of blank pixels to place between each line. | |
int | maxChars |
Maximum number of characters that the control will display. | |
caseString | text |
Text to display in this control. | |
bool | useURLMouseCursor |
If true, the mouse cursor will turn into a hand cursor while over a link in the text. |
A text control that uses the Gui Markup Language ('ML') tags to dynamically change the text.
Example of dynamic changes include colors, styles, and/or hyperlinks. These changes can occur without having to use separate text controls with separate text profiles.
new GuiMLTextCtrl(CenterPrintText) { lineSpacing = "2"; allowColorChars = "0"; maxChars = "-1"; deniedSound = "DeniedSoundProfile"; text = "The Text for This Control."; useURLMouseCursor = "true"; //Properties not specific to this control have been omitted from this example. };
void GuiMLTextCtrl::addText | ( | string | text, | |
bool | reformat | |||
) |
Appends the text in the control with additional text. Also .
text | New text to append to the existing text. | |
reformat | If true, the control will also be visually reset. |
void GuiMLTextCtrl::forceReflow | ( | ) |
Forces the text control to reflow the text after new text is added, possibly resizing the control.
// Define new text to add %newText = "BACON!"; // Add the new text to the control %thisGuiMLTextCtrl.addText(%newText); // Inform the GuiMLTextCtrl object to force a reflow to ensure the added text fits properly. %thisGuiMLTextCtrl.forceReflow();
string GuiMLTextCtrl::getText | ( | ) |
Returns the text from the control, including TorqueML characters.
// Get the text displayed in the control
%controlText = %thisGuiMLTextCtrl.getText();
void GuiMLTextCtrl::onResize | ( | string | width, | |
string | maxY | |||
) |
Called whenever the control size changes.
width | The new width value for the control | |
maxY | The current maximum allowed Y value for the control |
// Control size changed, causing the callback to occur. GuiMLTextCtrl::onResize(%this,%width,%maxY) { // Code to call when the control size changes }
void GuiMLTextCtrl::onURL | ( | string | url | ) |
Called whenever a URL was clicked on within the control.
url | The URL address that was clicked on. |
// A URL address was clicked on in the control, causing the callback to occur. GuiMLTextCtrl::onUrl(%this,%url) { // Code to run whenever a URL was clicked on }
void GuiMLTextCtrl::scrollToBottom | ( | ) |
Scroll to the bottom of the text.
// Inform GuiMLTextCtrl object to scroll to its bottom
%thisGuiMLTextCtrl.scrollToBottom();
void GuiMLTextCtrl::scrollToTag | ( | int | tagID | ) |
Scroll down to a specified tag.
Detailed description
tagID | TagID to scroll the control to |
// Define the TagID we want to scroll the control to %tagId = "4"; // Inform the GuiMLTextCtrl to scroll to the defined TagID %thisGuiMLTextCtrl.scrollToTag(%tagId);
void GuiMLTextCtrl::scrollToTop | ( | int | param1, | |
int | param2 | |||
) |
Scroll to the top of the text.
// Inform GuiMLTextCtrl object to scroll to its top
%thisGuiMLTextCtrl.scrollToTop();
void GuiMLTextCtrl::setAlpha | ( | float | alphaVal | ) |
Sets the alpha value of the control.
alphaVal | n - 1.0 floating value for the alpha |
// Define the alphe value %alphaVal = "0.5"; // Inform the control to update its alpha value. %thisGuiMLTextCtrl.setAlpha(%alphaVal);
bool GuiMLTextCtrl::setCursorPosition | ( | int | newPos | ) |
Change the text cursor's position to a new defined offset within the text in the control.
newPos | Offset to place cursor. |
void GuiMLTextCtrl::setText | ( | string | text | ) |
Set the text contained in the control.
text | The text to display in the control. |
If true, the control will allow characters to have unique colors.
If the text will not fit in the control, the deniedSound is played.
The number of blank pixels to place between each line.
Maximum number of characters that the control will display.
caseString GuiMLTextCtrl::text |
Text to display in this control.
If true, the mouse cursor will turn into a hand cursor while over a link in the text.
This is dependant on the markup language used by the GuiMLTextCtrl