TextEdit.AppendText
From Xojo Documentation
This item was deprecated in version 2019r2. Please use TextEdit.AddText as a replacement. |
Method
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 1000 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 the text, 1000 characters at a time
// into the TextField
While Not t.EOF
myTextArea.AppendText(t.Read(1000, 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
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 the text, 1000 characters at a time
// into the TextField
While Not t.EOF
myTextArea.AppendText(t.Read(1000, 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