Question 1: How do I ensure the text in a TextArea is not editable or selectable by the user?
Question 2: How do I make part of the text of a TextArea bold dynamically? Like certain words that the user types in for instance.
I tried to do something like this:
using unifill.Unifill;
var keyword:String="test";
var tf:TextFormat = text.getTextDisplay().textField.getTextFormat(0, 1);
tf.font = Assets.getFont("font/Nunito-Bold.ttf").fontName;
tf.bold = true;
var beginBoldIndex:Int = text.text.uIndexOf(keyword);
if (beginBoldIndex !=-1) {
var endBoldIndex:Int = text.text.uIndexOf("\n", beginBoldIndex);
if (endBoldIndex ==-1) endBoldIndex = text.text.uIndexOf("\r", beginBoldIndex);
text.getTextDisplay().textField.setTextFormat(tf, beginBoldIndex, endBoldIndex);
}
}
But that doesn’t work. Both the internal TextInput and TextDisplay seem to have empty text members. And the TextArea itself does not use TextFormat.