Often one needs to do things like replace part of the text of a "Text" control, and in particular with a TextArea one needs to append a new line to "log" additional information.
The "slow boat" in VB6 and earlier was to retrieve the entire Text property's value, concatenate, and then store the new bigger string back into the control by writing to the Text property. This can be improved on by moving the caret (insertion point) to the end of the text by using the maximum possible length value and then setting the SelText property.
Even though the JavaFX TextArea does have a method named "replaceSelection" this does not appear to be exposed in B4J.
Is this an omission or am I missing some other syntax or workaround? Since we do have SetSelection as well as SelectAll and other members exposed to us it seems logical we'd have a way to read and write the selection.
The "slow boat" in VB6 and earlier was to retrieve the entire Text property's value, concatenate, and then store the new bigger string back into the control by writing to the Text property. This can be improved on by moving the caret (insertion point) to the end of the text by using the maximum possible length value and then setting the SelText property.
Even though the JavaFX TextArea does have a method named "replaceSelection" this does not appear to be exposed in B4J.
B4X:
Sub LogIt(Text As String)
'Does not work:
'TextLog.SetSelection(0x7ffffff, 0x7fffffff)
'TextLog.SelectedText = Text & CRLF <-- No such property exposed.
'Must use:
TextLog.Text = TextLog.Text & Text & CRLF
End Sub
Is this an omission or am I missing some other syntax or workaround? Since we do have SetSelection as well as SelectAll and other members exposed to us it seems logical we'd have a way to read and write the selection.