TextEdit.AppendText

From Real Software Documentation

Jump to: navigation, search
Method
TextEdit.AppendText ( text as String )

Appends the passed text to the current Text. Call AppendText rather than using the + operator to append text to existing text.


Example

This example reads a text field in blocks of 256 characters using Read.

dim f as folderItem
dim dlg as openDialog
dim t as textInputStream

//create a new openDialog
dlg = new OpenDialog
//set what type of file it looks for
dlg.filter="text/plain"

//run the dialog
f = dlg.showModal

//check to make sure the user didn't click cancel
if f <> nil then

t = TextInputStream.Open(f)
//make sure we could open it
if t <> nil then
//Read all of t into myEditField.text

//myEditField.text=t.readAll
While not t.EOF
myEditfield.appendtext(t.read(256,Encodings.UTF8))
wend

t.close
else
//the file could not be a read as a text file
msgBox "The selected file is not a text file. Error: "+str(t.LastErrorCode)
end if
else
//the user clicked cancel... just ignore it
end if
Personal tools