# UMG - Widgets event as parameters?

**URL:** <https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486>\
**Category:** UI\
**Tags:** parameters, unreal-engine, Widget, question, UE4-27\
**Created:** [February 7, 2022, 10:30pm UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486 "2022-02-07T22:30:55Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil123456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@phil123456](https://forums.unrealengine.com/u/phil123456)\
**Post date:** [February 7, 2022, 10:30pm UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486/1 "2022-02-07T22:30:55Z")

</div>

Hi,

I created a custom Button widget

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/5/7/257624cbbc9a83d7beeaf7b41c6500f9d1016bcd.png)

**I use a caption variable that initializes it in editor**

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/a/5/7a5808b82b0ff9d9e763efde14db4b60879abe2f.png)

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/e/e/5ee9e8f7dde845c4e82a4805ce4d81b71ccd3113.png)

**question :**

I want to pass another variable containing a **call back/custom event** for an action that would be triggered by the button

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/3/1/231ee0d72fbbba933e4ef5b946ba38c09c22894e.png)

how do I do that ?

thanks for en-lighting my path

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 8, 2022, 3:54pm UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486/2 "2022-02-08T15:54:31Z")

</div>

You bind it in the external blueprint:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/f/9/9f91c9e4b13d61722089b2b75bfe30ad79d3cf00.png)

Above: the widget’s button, when clicked, will trigger the custom event in this blueprint.

* * *

You can also create a custom dispatcher and send some data across. This way you can bind multiple buttons to the same event and use said data as a filter, as in:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/c/1/6c16be14493b61231f0e4317392ad559fe054ad6.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/5/805f8f37ce19c9e06cc71fa9ec2806e76f561bd3.png)

I feel like we discussed this last week.

---

<div class="post-metadata">

**Author:** ![phil123456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@phil123456](https://forums.unrealengine.com/u/phil123456)\
**Post date:** [February 8, 2022, 4:25pm UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486/3 "2022-02-08T16:25:20Z")

</div>

thanks

yeah something similar

---

<div class="post-metadata">

**Author:** ![phil123456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@phil123456](https://forums.unrealengine.com/u/phil123456)\
**Post date:** [February 9, 2022, 8:45am UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486/4 "2022-02-09T08:45:26Z")

</div>

but I cannot bind to on clicked since the component is complex, it’s not just a button  
hence my question of passing a custom event as a parameter that would then be given to the button on clicked action

like a callback in c++

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 9, 2022, 8:47am UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486/5 "2022-02-09T08:47:47Z")

</div>

> [@phil123456](#):
>
> but I cannot bind to on clicked since the component is complex, it’s not just a button

Any widget can override _onMouseDown_ / _onKeyDown_. Call the event dispatcher there. Pretty much any native widgets can be interacted with / have focus. No buttons needed, indeed. Buttons often get in the way, actually.

Every time you do something to a widget, a piece (however many registered) of code gets a notification.

Other than that, I don’t understand what kind of callback you’re after.

* * *

> but I cannot bind to on clicked since the component is complex, it’s not just a button

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/3/943a8b2e32e45be480062e23dba8ca6df78c29b3.png)

I hope you understand my confusion 🙂

---

<div class="post-metadata">

**Author:** ![phil123456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@phil123456](https://forums.unrealengine.com/u/phil123456)\
**Post date:** [February 9, 2022, 8:54am UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486/6 "2022-02-09T08:54:32Z")

</div>

the idea is that I’ll re use that component many times, so in its parent widget I need to just bind a different function/event/callback whatever so that each button click triggers a different functionality

it’s just a game menu, but I don’t use a plain button component, it’s embedded as the image I posted

so the button onclicked is there, but I should launch a different event from there

if I select my custom widget, there are no mousedown event on it

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/c/8/4c8df54b6738bea7bbc55f1344f7466576dfba4c.png)

so far I have set the event inside the component but it’s obviously not what I want

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/0/f/90fbfd7d1af6d8d38929df380f1048725d2110d6.png)

the event itself must be set in the parent component (the menu) with a different event for each button widget

[edit] pretty sure I have to use dispatchers in this case

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [February 9, 2022, 9:05am UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486/7 "2022-02-09T09:05:36Z")

</div>

> [@phil123456](#):
>
> if I select my custom widget, there are no mousedown event on it

The overrides are inside the widget. But I think I know what you need now.

* * *

If you want this Event List populated, you use an Event Dispatcher:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/6/7/e67124b9549ee5b643f7070538368ebef2364e52.png)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/3/6/f3601127e672a1153b018c339cebeee548fc1a18.png)

This is sometimes referred to as _autobind_ - not sure if that’s the correct term. The above is using a single dispatcher for all buttons. If you want multiple unique events, add more dispatchers:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/4/2/942852c78ccae0ff243cc5487c20a924dfb72f48.png)

---

<div class="post-metadata">

**Author:** ![phil123456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@phil123456](https://forums.unrealengine.com/u/phil123456)\
**Post date:** [February 9, 2022, 9:23am UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486/8 "2022-02-09T09:23:13Z")

</div>

I dont understad, where do I add the event dispatcher in the parent ?  
cos I dont get any green button

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/7/a/77a458653d8993de2a167a34cf20d94aaa433348.png)

---

<div class="post-metadata">

**Author:** ![phil123456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@phil123456](https://forums.unrealengine.com/u/phil123456)\
**Post date:** [February 9, 2022, 8:34pm UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486/10 "2022-02-09T20:34:58Z")

</div>

well still dont work for me  
I dont see the link between the dispatcher end the push button

…unreal too, clicking on the button just does nothing

I cannot acces onclicks of each buttons from the main menu widget

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/7/b/17bf97510d857637916f8262f55679c8eebc98c7.png)

---

<div class="post-metadata">

**Author:** ![phil123456](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@phil123456](https://forums.unrealengine.com/u/phil123456)\
**Post date:** [February 9, 2022, 8:42pm UTC](https://forums.unrealengine.com/t/umg-widgets-event-as-parameters/495486/11 "2022-02-09T20:42:33Z")

</div>

ok my bad I missed

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/4/7/1479424736ed1ee802a669e717c9928d4c35d912.png)
