Caret Position

I’m currently trying to work with the Text Area component and would like to be able to find the caret position inside the Text Area. I know I can use the getCaretPosition() on the Text Field component but it does not appear to work on the Text Area component. I would use the Text Field component in my project but the user needs to be able to enter a large amount of text. It might not be possible to do this with the Text Area component but any help would be appreciated or alternatives. Thanks in advance.


You can still use that function on the text area, it just happens to be that the text area is inside of a scrollpane component. You can do the following:print event.source.parent.getComponent("Text Area").getViewport().getView().getCaretPosition()

I have a (7.8.5) Text Area whose text I assign in a script, but I would like the caret to be positioned at the end of the text following the assignment. When I ask my Text Area named ‘Description Text’ to .getViewport().getView I get an anonymous inner instance, PMITextArea$1 named ‘Description Text->view’ and it does not have a method named setCaretPosition( ) nor one named getCaretPosition( ) for that matter. Can you provide me with another way to get the caret positioned where I’d like?
Many thanks in advance,

Post your code…

My error (I am still learning to love Python’s implicit variable declaration); it was a spelling mistake. :blush: