Game Development Community

GuiMLTextCtrl question

by Rami Sleiman · in Torque Game Engine · 02/16/2010 (11:11 am) · 7 replies

Sorry if this is in the wrong forum, was not sure where to put this.

So I'm using a GuiMLTextCtrl to type out highscore, but I have a problem.
I can not find a way to limit the length of it. I only want it to type out a maximum of 7 lines.

Is there a way to do this?

About the author

Recent Threads

  • Costum key mapping

  • #1
    02/16/2010 (12:02 pm)
    Use the maxChars field.
    maxChars = 7;
    #2
    02/16/2010 (12:12 pm)
    Not what I'm looking for.

    What I meant was the maximum amount of lines.

    Sorry, badly explained.
    #3
    02/18/2010 (8:10 am)
    bump
    #4
    02/18/2010 (11:20 am)
    That could be tricky without modifying the source. Are you using a \n tag to create a new line each time? Also, are you using setText() or addText()?
    #5
    02/18/2010 (11:25 am)
    I'm using \n and add text.

    highscore.addText("\n" @ $highscore, true);
    #6
    02/18/2010 (12:34 pm)
    Simply count the lines you are adding and add no more if you are over the limit.

    If you want to display the last 7 lines added then the easiest thing is probably to separately manually maintain the string, clip off a prefix if needed (use strpos to find the first newline and getsubstr to extract the remainder of the string) and then use ML's setText to set the entire text and reflow.
    #7
    02/18/2010 (1:25 pm)
    Thanks for the help.