Can I register a second click on a widget?

For example I have a button widget and it does something on click (an animation). But for the second click on the same button widget I want it to do something different (different animation).

Is this possible? Thanks.

Have you try 2 button, first one click is from 1 to 2, second one is in state 2 then you can click 2 time with different behavior ?

Thanks for the reply. Sorry, I don’t think I understand. Should I use 2 buttons and use different animations for each one? The problem is I only have one button which is static and I cant place two button widgets in the same spot.

Why don’t you set a bool on button click? That way you can do two things with one button…

Scenario:

  • button clicked, set bool true
  • branch from bool, if true play animation 1
  • button clicked again, set bool false
  • branch from bool, if false play animation 2

Hope it helps :slight_smile:

Hey Justin. I understand the logic, but I can’t find a way to call the same widget button twice in order to check if it was clicked a second time. OnClickButton only has exits.

There is a big difference between clicking a button twice (a toggle) and double clicking something in quick succession for a different effect.

The answer I provided you with works for a button widget and makes it a pseudo toggle button. That way every time you click it something else happens. So clicking it once will activate anim 1, clicking it twice anim 2, three times anim 1, so on and so forth. At no point in time could you directly access anim 2 without going through anim 1.

If you are looking for something that allows an event double clicked, you need to look at Border widget instead of Button. Border comes with 4 event listeners onMouseButtonDown, onMouseButtonUp, onMouseMove and onMouseDoubleClick.

can you pls provide a Blueprint for this? how to set click and click again in a button