Binding onHover event on each widget button created in foreach loop

Hello everyone, i cant find solution for my problem:

  1. Im getting all saved game profiles into array
  2. I need create widget (only with button) for each element in that array
  3. for each button i need bind event onHover/onClick
  4. that event will call my function which set my variables ServerName and MaxPlayers

But my solution doesnt work and in variables ServerName and MaxPlayers are every time values only from last index in array.

Thx for your time.

I cant get my variables in Create Widget function.

Still no solution for that?

Make your own Button subclass with its own OnClick/OnHover dispatcher, which passes Self as a parameter when triggered. This way you can still differentiate them when you bind them all to the same function in parent container.

1 Like