# Caret Position

**URL:** <https://forum.inductiveautomation.com/t/caret-position/5649>\
**Category:** Ignition\
**Created:** [January 4, 2013, 10:31pm UTC](https://forum.inductiveautomation.com/t/caret-position/5649 "2013-01-04T22:31:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![WillMT10](https://avatars.discourse-cdn.com/v4/letter/w/7feea3/32.png) [@WillMT10](https://forum.inductiveautomation.com/u/WillMT10)\
**Post date:** [January 4, 2013, 10:31pm UTC](https://forum.inductiveautomation.com/t/caret-position/5649/1 "2013-01-04T22:31:05Z")

</div>

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.

-Will

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 5, 2013, 1:08am UTC](https://forum.inductiveautomation.com/t/caret-position/5649/2 "2013-01-05T01:08:45Z")

</div>

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()`

---

<div class="post-metadata">

**Author:** ![rob.bosworth](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@rob.bosworth](https://forum.inductiveautomation.com/u/rob.bosworth)\
**Post date:** [November 2, 2017, 2:54pm UTC](https://forum.inductiveautomation.com/t/caret-position/5649/3 "2017-11-02T14:54:29Z")

</div>

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,  
Rob

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [November 2, 2017, 3:14pm UTC](https://forum.inductiveautomation.com/t/caret-position/5649/4 "2017-11-02T15:14:59Z")

</div>

Post your code…

---

<div class="post-metadata">

**Author:** ![rob.bosworth](https://avatars.discourse-cdn.com/v4/letter/r/ec9cab/32.png) [@rob.bosworth](https://forum.inductiveautomation.com/u/rob.bosworth)\
**Post date:** [November 2, 2017, 3:43pm UTC](https://forum.inductiveautomation.com/t/caret-position/5649/5 "2017-11-02T15:43:40Z")

</div>

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