# Setting focus or remove ability to recieve focus

**URL:** <https://forum.inductiveautomation.com/t/setting-focus-or-remove-ability-to-recieve-focus/2945>\
**Category:** Ignition\
**Created:** [May 17, 2011, 5:33pm UTC](https://forum.inductiveautomation.com/t/setting-focus-or-remove-ability-to-recieve-focus/2945 "2011-05-17T17:33:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jim\_lapratt](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jim\_lapratt](https://forum.inductiveautomation.com/u/jim_lapratt)\
**Post date:** [May 17, 2011, 5:33pm UTC](https://forum.inductiveautomation.com/t/setting-focus-or-remove-ability-to-recieve-focus/2945/1 "2011-05-17T17:33:01Z")

</div>

I have a window with many components on it. There is a submit button at the bottom of the screen. After it is press the focus returns to the top left input box on screen. I would really like it to set focus to no component on screen, then user can click into which component they want to change.

---

<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:** [May 30, 2011, 3:59am UTC](https://forum.inductiveautomation.com/t/setting-focus-or-remove-ability-to-recieve-focus/2945/2 "2011-05-30T03:59:58Z")

</div>

Is the submit button closing/opening a screen? I’m confused why the button itself wouldn’t retain the focus after being pressed.

Focus is a strange animal. There isn’t really a way to have nothing have focus. The best bet is to have something take the focus that isn’t so obvious (like a blinking cursor in a text field)

All components have a function on them called requestFocusInWindow() that you can call to move focus to that component. (Note: only focusable components will actually successfully receive focus.)

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [May 31, 2011, 8:19pm UTC](https://forum.inductiveautomation.com/t/setting-focus-or-remove-ability-to-recieve-focus/2945/3 "2011-05-31T20:19:51Z")

</div>

I played with this a little while ago…

If I remember correctly:

By default containers aren’t focusable. In order to give the appearance that nothing had focus, I made a container (I think it was the root container) focusable, and used requestFocusInWindow() (as Carl suggested).

Making a container focusable uses java’s setFocusable() method. Through the magic of jython, the code actually looks like this:

`container.focusable = 1
container.requestFocusInWindow()`
