# How set UMG button as pressed from BP script?

**URL:** <https://forums.unrealengine.com/t/how-set-umg-button-as-pressed-from-bp-script/487037>\
**Category:** Blueprint\
**Tags:** onclick, unreal-engine, Blueprint, question, UMG\
**Created:** [August 4, 2021, 7:15pm UTC](https://forums.unrealengine.com/t/how-set-umg-button-as-pressed-from-bp-script/487037 "2021-08-04T19:15:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hybris6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hybris6](https://forums.unrealengine.com/u/Hybris6)\
**Post date:** [August 4, 2021, 7:15pm UTC](https://forums.unrealengine.com/t/how-set-umg-button-as-pressed-from-bp-script/487037/1 "2021-08-04T19:15:17Z")

</div>

Hi,  
in (widget) Blueprint what is the command to activate a UMG button (like if it was clicked).

I have an actionbar with 3 umg buttons. In the actionbar script Im listening for keys like if I press 1 the first umg button should activate. I have the listening part done (atm I just printstring from widget key 1…2…3… pressed) and it works good.

Now instead of the printstring I make a custom event and then I get “actionbar slot 1” → Button but here I don’t know what to call to simulate the button is clicked. What function should I use from the button?

Thanks

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [August 5, 2021, 7:06am UTC](https://forums.unrealengine.com/t/how-set-umg-button-as-pressed-from-bp-script/487037/2 "2021-08-05T07:06:21Z")

</div>

Just connect a custom event to the same place as the button clicked event, and call that. ( I don’t think there is a ‘button clicked’ fake event. )

---

<div class="post-metadata">

**Author:** ![UnrealSolver](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/unrealsolver/32/1194693_2.png) [@UnrealSolver](https://forums.unrealengine.com/u/UnrealSolver)\
**Post date:** [August 5, 2021, 11:02am UTC](https://forums.unrealengine.com/t/how-set-umg-button-as-pressed-from-bp-script/487037/3 "2021-08-05T11:02:29Z")

</div>

Like **@ClockworkOcean** mentioned - there’s no fake event for pressing buttons

If you wanna have the functionality both from clicking the buttons and pressing keyboard keys - add a custom event to the beginning of the code (where you have the event OnButtonClicked) and run it as you press the responsible keys

Fake click simulation is possible only via Widget Component + Widget interaction but it’s something different from what you need but you can take a look on that for learning purposes ;]

---

<div class="post-metadata">

**Author:** ![Hybris6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hybris6](https://forums.unrealengine.com/u/Hybris6)\
**Post date:** [August 30, 2021, 8:15am UTC](https://forums.unrealengine.com/t/how-set-umg-button-as-pressed-from-bp-script/487037/4 "2021-08-30T08:15:25Z")

</div>

Hi,  
sorry for my late reply.

Thanks to both of you.

I used “Listen for input action” and ran the onkeypress code through a custom event.
