# Requesting focus for a Text Area

**URL:** <https://forum.inductiveautomation.com/t/requesting-focus-for-a-text-area/2216>\
**Category:** Ignition\
**Created:** [September 23, 2010, 4:46pm UTC](https://forum.inductiveautomation.com/t/requesting-focus-for-a-text-area/2216 "2010-09-23T16:46:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [September 23, 2010, 4:46pm UTC](https://forum.inductiveautomation.com/t/requesting-focus-for-a-text-area/2216/1 "2010-09-23T16:46:14Z")

</div>

On some of the windows in our current system, I force the focus to a particular control when the window opens by using the following code in the window’s internalFrameActivated event:`def requestFocus(event=event):
	import system
	system.gui.getParentWindow(event).getComponentForPath('Root Container.controlName').requestFocusInWindow()
system.util.invokeLater(requestFocus)`This works well in every case except when I try to request the focus for a Text Area - this doesn’t seem to accept the focus.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [September 28, 2010, 9:28pm UTC](https://forum.inductiveautomation.com/t/requesting-focus-for-a-text-area/2216/2 "2010-09-28T21:28:41Z")

</div>

The difference is probably that the text area is actually a scroll pane that holds a text area. Try this:

`def requestFocus(event=event):
   import system
   textArea = system.gui.getParentWindow(event).getComponentForPath('Root Container.controlName')
   textArea.viewport.view.requestFocusInWindow()
system.util.invokeLater(requestFocus)`

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [September 29, 2010, 7:03am UTC](https://forum.inductiveautomation.com/t/requesting-focus-for-a-text-area/2216/3 "2010-09-29T07:03:04Z")

</div>

Thanks Carl, that works perfectly.
