# Why I can't I directly bind a function to a button's OnClicked event?

**URL:** <https://forums.unrealengine.com/t/why-i-cant-i-directly-bind-a-function-to-a-buttons-onclicked-event/340680>\
**Category:** UI\
**Tags:** button, dispatcher, unreal-engine, UE4, question, Blueprint\
**Created:** [December 6, 2015, 5:20pm UTC](https://forums.unrealengine.com/t/why-i-cant-i-directly-bind-a-function-to-a-buttons-onclicked-event/340680 "2015-12-06T17:20:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HInoue](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HInoue](https://forums.unrealengine.com/u/HInoue)\
**Post date:** [December 6, 2015, 5:20pm UTC](https://forums.unrealengine.com/t/why-i-cant-i-directly-bind-a-function-to-a-buttons-onclicked-event/340680/1 "2015-12-06T17:20:58Z")

</div>

I have a function that generates an unknown number of buttons at runtime, and I’m trying to initialize each button by binding it’s OnClicked event to the DisplayInformation function I want to run every time that button is clicked:

 ![69524-eventref.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/f/4ffe41838ec3edaa6e2cf0ce559baa38415b4534.jpeg)

Obviously my function node isn’t compatible with the event node, so I tried creating a custom ButtonClicked event, running my function from there, and binding my ButtonClicked event to the actual OnClicked event. [Creating Dispatcher Events | Unreal Engine Documentation](https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/EventDispatcher/CreatingEvents/index.html) makes it look like I can do this by selecting the “Add custom event for Dispatcher” option, but as my screenshot shows I don’t have that option available when I open the context menu.

So am I doing something obviously wrong? I really don’t understand the chain of event to dispatcher to function that I’m supposed to be following.

---

<div class="post-metadata">

**Author:** ![rynix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rynix](https://forums.unrealengine.com/u/rynix)\
**Post date:** [December 6, 2015, 8:12pm UTC](https://forums.unrealengine.com/t/why-i-cant-i-directly-bind-a-function-to-a-buttons-onclicked-event/340680/2 "2015-12-06T20:12:19Z")

</div>

Hi,

You should be able to select `Create Event`, pass `self` to the new event and select the function from there.

---

<div class="post-metadata">

**Author:** ![HInoue](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HInoue](https://forums.unrealengine.com/u/HInoue)\
**Post date:** [December 6, 2015, 9:49pm UTC](https://forums.unrealengine.com/t/why-i-cant-i-directly-bind-a-function-to-a-buttons-onclicked-event/340680/3 "2015-12-06T21:49:11Z")

</div>

That did it perfectly, thank you 🙂

For some reason I was thinking that Create Event created a new delegate or dispatcher, instead of accessing an existing one, hence my problem ^^
