To replace the complete contents of a Text object named myText with a new string, use the following syntax:
myText.SetSelection(0,-1);myText.ReplaceSelection("This is my new text");