# \[Solved\] What is the input box property to check if the box has focus?

**URL:** <https://forum.inductiveautomation.com/t/solved-what-is-the-input-box-property-to-check-if-the-box-has-focus/55989>\
**Category:** Ignition\
**Tags:** ignition81, vision, scripting\
**Created:** [February 10, 2022, 4:20pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-input-box-property-to-check-if-the-box-has-focus/55989 "2022-02-10T16:20:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 10, 2022, 4:20pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-input-box-property-to-check-if-the-box-has-focus/55989/1 "2022-02-10T16:20:26Z")

</div>

I have an input box and I want to check if the user has given it focus or not. What property do I compare against to check this? To check if the text changed I would do something similar to this below.

```auto
if propertyName == 'text':
    #code
    pass
```

But that doesn’t help me if I want to know whether the box is focused or not.

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![zacht](https://avatars.discourse-cdn.com/v4/letter/z/ea5d25/32.png) [@zacht](https://forum.inductiveautomation.com/u/zacht)\
**Post date:** [February 10, 2022, 4:30pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-input-box-property-to-check-if-the-box-has-focus/55989/2 "2022-02-10T16:30:15Z")

</div>

I don’t know if there’s a property, but there are focusGained and focusLost event handlers. You can write scripts that execute when a specific event occurs. This could include writing a value to a custom property of the component.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [February 10, 2022, 4:32pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-input-box-property-to-check-if-the-box-has-focus/55989/3 "2022-02-10T16:32:30Z")

</div>

There is not a property event for that, @zacht is right, use the `focusGained` event handlers. Also, I find it handy to print the event.propertyName unfiltered which allows you to see what properties are changing and when they fire for debugging.

```auto
print event.propertyName

```

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [February 10, 2022, 5:03pm UTC](https://forum.inductiveautomation.com/t/solved-what-is-the-input-box-property-to-check-if-the-box-has-focus/55989/4 "2022-02-10T17:03:38Z")

</div>

This will have to suffice. Thanks.
