# Stopping focus moving to controls

**URL:** <https://forum.inductiveautomation.com/t/stopping-focus-moving-to-controls/1393>\
**Category:** Archived Topics\
**Created:** [December 2, 2009, 10:09am UTC](https://forum.inductiveautomation.com/t/stopping-focus-moving-to-controls/1393 "2009-12-02T10:09:00Z")\
**Posts on this page:** 2\
**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:** [December 2, 2009, 10:09am UTC](https://forum.inductiveautomation.com/t/stopping-focus-moving-to-controls/1393/1 "2009-12-02T10:09:00Z")

</div>

If a field is set to not be editable, it should not be able to receive the focus, otherwise it can lead to confusion for users who think that because it gets the focus they should be able to change it.

---

<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:** [December 2, 2009, 10:17am UTC](https://forum.inductiveautomation.com/t/stopping-focus-moving-to-controls/1393/2 "2009-12-02T10:17:33Z")

</div>

As a workaround I’ve put the following code in the focusGained event of the control I don’t want to receive the focus:

```auto
if event.oppositeComponent.name == "previousControlName":
	event.source.transferFocus()
elif event.oppositeComponent.name == "followingControlName":
	event.source.transferFocusBackward()

```
