GuiMlTextControl New Line isn't quite working...
by Orion the Hunter · in Torque Game Builder · 12/08/2012 (10:53 am) · 8 replies
Okay, so I made this function so if a level isn't loaded you are taken back to the menu and a message pops up explaining the situation:
The text CTRL is this:
The problem is I can't make it do new lines as indicated with the "NL" marks... I've looked all over the forums but I can't find a solution.
Thanks, guys! :)
$AYSText = "It appears that there is no data to read yet." NL "Please make a save before attempting to load." NL "I can\'t just materilize files out" NL "of thin air, you know.";
The text CTRL is this:
new GuiTextCtrl(AYSText) {
canSaveDynamicFields = "0";
isContainer = "0";
Profile = "GuiMLTextProfile";
HorizSizing = "center";
VertSizing = "center";
Variable = "$AYSText";
Position = "16 40";
Extent = "440 144";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
maxLength = "1024";The problem is I can't make it do new lines as indicated with the "NL" marks... I've looked all over the forums but I can't find a solution.
Thanks, guys! :)
#2
Additionally, "ML" doesn't stand for "multi-line," it stands for "Markup Language."
Finally, to get a new line, use <br>.
12/08/2012 (3:27 pm)
The control you linked isn't a GuiMLTextCtrl.Additionally, "ML" doesn't stand for "multi-line," it stands for "Markup Language."
Finally, to get a new line, use <br>.
$AYSText = "It appears that there is no data to read yet.<br>Please make a save before attempting to load.<br>I can\'t just materialize files out<br>of thin air, you know.";
#3
12/09/2012 (8:42 am)
Well actually I use NL (New Line). Your BR method worked. :)
#4
12/09/2012 (8:53 am)
Can you do other html tags in gui text?
#5
"stripControlChars" function lists a bunch of tags it can take out.
This also lists a bunch tdn.garagegames.com/wiki/GUI/Profiles/ControlList#GuiMLTextCtrl
12/09/2012 (10:03 am)
guiMLTextCtrl.cc "stripControlChars" function lists a bunch of tags it can take out.
This also lists a bunch tdn.garagegames.com/wiki/GUI/Profiles/ControlList#GuiMLTextCtrl
#6
You can actually insert hyperlinks and other nifty things like color tagging into the MLText controls, but the MLtext controls expect the mark-up versions for NL and TAB. In T3D the tooltip in the GUI editor is misleading in that it says "multi-line text" - and that's what most people generally use it for. The other cool features are usually overlooked.
12/09/2012 (10:43 am)
I was referring to the "ML" in the control class name - in script NL works for concatenating strings with a \n character, but only some controls display this correctly.You can actually insert hyperlinks and other nifty things like color tagging into the MLText controls, but the MLtext controls expect the mark-up versions for NL and TAB. In T3D the tooltip in the GUI editor is misleading in that it says "multi-line text" - and that's what most people generally use it for. The other cool features are usually overlooked.
#7
Another note - MLText controls auto-size vertically by default, so if you have dynamic text that can be displayed and there is a possibility that the control could grow to a length that would not display properly you should put it inside of a scroll control and set the scrollbars to dynamic. That way, if your text is too long a vertical scrollbar will appear to allow your users to scroll through your text.
12/09/2012 (10:50 am)
But I think what I'm really getting at is that this:new GuiTextCtrl(AYSText) {should be this:new GuiMLTextCtrl(AYSText) {And then all of the awesome markup features and the default multi-line display features will be available.Another note - MLText controls auto-size vertically by default, so if you have dynamic text that can be displayed and there is a possibility that the control could grow to a length that would not display properly you should put it inside of a scroll control and set the scrollbars to dynamic. That way, if your text is too long a vertical scrollbar will appear to allow your users to scroll through your text.
#8
12/10/2012 (11:11 am)
^That's what I did. :) I found out about that method, too. Thanks.
Torque Owner Kevin James
Or maybe even Windows-style newlines...