Skip to main content
May 15, 2012
Question

how to modify text in a textbox?

  • May 15, 2012
  • 1 reply
  • 1445 views

Whenever i do _root.textboxname.text = "new text"; it turns the textbox blank.  What am I doing wrong?

This topic has been closed for replies.

1 reply

Inspiring
May 15, 2012

How do you have it set up?

Remember the text will only go the length of the textbox, so if the box is 1 character long then it will only display: n (the first character).

The textbox should be dynamic or input, with an instance name. E.g. textboxname

May 17, 2012

I have it set up correctly, as far as I can tell.  Initial text is 4 letters "text" and even setting it to = "a" still makes it a blank text box.  The only thing I have gotten to work is creating a second textbox and telling it textbox1 = textbox2.  It working correctly up to the point of changing the text, its only when the text gets changed that it becomes blank.

textbox info: dynamic textbox, instance name "tester_text", initial text "text", width 130, height 80


_root.tester_text.text = "a";

When that line of code get's called, the text box goes completely blank.

(added)
I found the issue, sort of.  If the textbox doesn't have anything in it then it works just fine.  But if it has text already in it then the issue above occurs.  Had a hunch, tried it out, blank text box works fine.

(second add)

It would be nice to know what the issue is, there will be times I want to edit code where the text box starts out with something in it.  Of course I could keep it blank and give it text at the start of the program if I have to...

Ned Murphy
Legend
May 17, 2012

Make sure the textfield is not set up as multiline (if it is not supposed to be)