How can I bind different events for multiple UMG widgets?

I have created a system to spawn (construct) Editor Utility Button’s. Each button has a different image:
image

I want to be able to click these buttons and have an event print out what color the button is.

The number of buttons will be different, so I can’t manually create a button for each color. It also seems that I can’t pass a reference through the Bind Event to On Clicked.

image

How can I do this? I preferably want to do all of this in a function:

  • Spawn all buttons
  • Add images with colors
  • Bind button On Clicked Event (with a reference to the button).
  • When I press any button, have it print the color of the images it contains.

Sounds really simple all of this? Well it isn’t, I must be doing something wrong, because I am nowhere to understanding how to get a bind event reference a button, or somehow get the button information / image color information.

Please help, I really can’t make sense of this.

1 Like
  • make each button a user widget
  • have some variables, call dispatcher onClick, pipe in desired data:

  • the parent owning the buttons (or any other actor / widget) can handle the delegates:

Fantastic! Works great! :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.