# UMG Input and Button Question

**URL:** <https://forums.unrealengine.com/t/umg-input-and-button-question/475972>\
**Category:** Community & Industry Discussion\
**Tags:** override, unreal-engine, question, UMG\
**Created:** [December 15, 2020, 11:59pm UTC](https://forums.unrealengine.com/t/umg-input-and-button-question/475972 "2020-12-15T23:59:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![JIMMYMANGO69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JIMMYMANGO69](https://forums.unrealengine.com/u/JIMMYMANGO69)\
**Post date:** [December 15, 2020, 11:59pm UTC](https://forums.unrealengine.com/t/umg-input-and-button-question/475972/1 "2020-12-15T23:59:51Z")

</div>

Hi. I have an inventory grid 4 by 4 with child slot widgets in a grid panel (16 slots). I added a button layer to the slot to allow navigation between the slots with the Game Controller. I have a function override for OnKeyDown and OnMousedown so I can equip and uniequip inventory or drop it etc. If I disable the Button - this code works fine, but I can’t navigate with the controller. If I enable the buttons I can navigate the grid with the controller but when I press FaceButton Bottom the button seems to capture the input and therefore the OnKeydown Override does not play. If I could I’d just add a custom event from the button press to the OnKeydown override function… but as you know you can’t add custom events to the functions… Does anyone know the best practice for using Buttons and OnKey overrides at the same time?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![WonsDos](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WonsDos](https://forums.unrealengine.com/u/WonsDos)\
**Post date:** [December 16, 2020, 12:15am UTC](https://forums.unrealengine.com/t/umg-input-and-button-question/475972/2 "2020-12-16T00:15:46Z")

</div>

If you want to override a general On Key Down function, try to use On Preview Key Down. This function works for all the children widgets, and On Key down function at the base widget works if the same key is not called at the on preview key down.

---

<div class="post-metadata">

**Author:** ![JIMMYMANGO69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JIMMYMANGO69](https://forums.unrealengine.com/u/JIMMYMANGO69)\
**Post date:** [December 16, 2020, 12:29am UTC](https://forums.unrealengine.com/t/umg-input-and-button-question/475972/3 "2020-12-16T00:29:45Z")

</div>

That was Brilliant worked like a charm.

---

<div class="post-metadata">

**Author:** ![JIMMYMANGO69](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JIMMYMANGO69](https://forums.unrealengine.com/u/JIMMYMANGO69)\
**Post date:** [December 16, 2020, 12:35am UTC](https://forums.unrealengine.com/t/umg-input-and-button-question/475972/4 "2020-12-16T00:35:42Z")

</div>

Anyone know why it’s called OnPreviewKeyDown? What an oddly worded function I don’t think I would have thought of that without someone telling me about it. Thanks!

---

<div class="post-metadata">

**Author:** ![WonsDos](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WonsDos](https://forums.unrealengine.com/u/WonsDos)\
**Post date:** [December 16, 2020, 4:57am UTC](https://forums.unrealengine.com/t/umg-input-and-button-question/475972/5 "2020-12-16T04:57:06Z")

</div>

Great! sounds great to hear that
