locked
controls.settextboxtext question! HELP!!!! RRS feed

  • Question

  • how do u make a new line in a multiline textbox?

    chase morell


    Monday, March 4, 2013 10:32 PM

Answers

  • The way you can set a new line in a text box would be using Text.GetCharacter(10), A.K.A. line feed. What it does is that that is the equivalent of enter. For example, if you had a textbox called 'box', and you wanted it to say this:

    this is some text

    this is some more text

    The code you would use would be like this:

    box = Controls.AddMultiLineTextBox(10,10)
    'character 10 is enter
    enter = Text.GetCharacter(10)
    Controls.SetTextBoxText(box,"this is some text"+enter+"this is some more text")
    When you use that, really all the computer thinks that says is "make a text box at x:10, y:10 and set its text to 'this is some text' plus an enter plus 'this is some more text'". If you have any other questions regarding this, we would love to answer them!


    I am an 11 year old that knows Small Basic and is learning Java and C. 'Binary is as easy as 1, 10, 11.'



    • Edited by Math Man Monday, March 4, 2013 10:49 PM
    • Proposed as answer by gungan37Editor Tuesday, March 5, 2013 1:58 AM
    • Marked as answer by Nonki Takahashi Monday, March 11, 2013 1:06 PM
    Monday, March 4, 2013 10:47 PM
  • You need to use the new line character (an invisible character that sends the cursor to the next line). You can get the newline character (ASCII code 10) like this:

    GraphicsWindow.Show()
    tb = Controls.AddMultiLineTextBox(5, 5)
    Controls.SetTextBoxText(tb, "Hello world" + Text.GetCharacter(10) + "This is a new line!")


    Please mark any answers and "vote as helpful" any posts that help you!

    Monday, March 4, 2013 10:49 PM
    Answerer

All replies

  • The way you can set a new line in a text box would be using Text.GetCharacter(10), A.K.A. line feed. What it does is that that is the equivalent of enter. For example, if you had a textbox called 'box', and you wanted it to say this:

    this is some text

    this is some more text

    The code you would use would be like this:

    box = Controls.AddMultiLineTextBox(10,10)
    'character 10 is enter
    enter = Text.GetCharacter(10)
    Controls.SetTextBoxText(box,"this is some text"+enter+"this is some more text")
    When you use that, really all the computer thinks that says is "make a text box at x:10, y:10 and set its text to 'this is some text' plus an enter plus 'this is some more text'". If you have any other questions regarding this, we would love to answer them!


    I am an 11 year old that knows Small Basic and is learning Java and C. 'Binary is as easy as 1, 10, 11.'



    • Edited by Math Man Monday, March 4, 2013 10:49 PM
    • Proposed as answer by gungan37Editor Tuesday, March 5, 2013 1:58 AM
    • Marked as answer by Nonki Takahashi Monday, March 11, 2013 1:06 PM
    Monday, March 4, 2013 10:47 PM
  • You need to use the new line character (an invisible character that sends the cursor to the next line). You can get the newline character (ASCII code 10) like this:

    GraphicsWindow.Show()
    tb = Controls.AddMultiLineTextBox(5, 5)
    Controls.SetTextBoxText(tb, "Hello world" + Text.GetCharacter(10) + "This is a new line!")


    Please mark any answers and "vote as helpful" any posts that help you!

    Monday, March 4, 2013 10:49 PM
    Answerer