Reputation: 11
I wish to search a TextArea
for some substring and, if its found, to select and scroll to it's position.
The search is not the issue, neither is the selection. What's troubling me is the TextArea
scrolling.
I've tried so far:
TextArea.caretPosition(int)/ TextArea.selectPositionCaret(int);
TextArea.caretPosition(int) / TextArea.extendSelection(int);
TextArea.selectRange(int, int)
But none of them seems to scrolls the TextArea
to the so selected text.
Any hints?
Upvotes: 0
Views: 385
Reputation: 11
I've just found my mistake...
The TextArea control must have the focus prior the selection changes.
All it's need:
TextArea.requestFocus();
TextArea.selectRange(int, int);
Upvotes: 1