UMG Toggle Buttons

Hello!

Im having a conundrum with UMG Toggle Buttons. Supposedly easy task but i cannot figure out how to:

  1. Find a better way to do the “uncheck rest if one button is checked”

Solution by : ClockworkOcean

Write a custom event that unchecks all buttons. Then, for each button, call the uncheck_all first, then check the button.

  1. Lock the button when checked so that you cannot uncheck it, only exception is checking other button.

Write a custom event that unchecks all buttons. Then, for each button, call the uncheck_all first, then check the button.

1 Like

Thanks, now need a tip to locking buttons when checked :smiley:

For the first one: What your trying to do is called radio buttons, where only one button can be checked at a time. Now, if only one button can be checked at a time, it’s no different than an enumeration. So either use an enumeration, or more simply, use a number that refers to which button is checked (i.e. 2 would be button 2, 5 would be button 5, 0 would be no buttons).

1 Like

For the second one: Bind the “IsEnabled” variable to a function that sets whether it should be enabled or not:
imageimage


This enables and disables the button every second.

2 Likes

Another solution that works for any number of widgets and does not require array iteration:

Wrap the native checkbox with a User Widget, dispatch its state and self reference:

And in the main widget holding checkboxes:

You probably don’t even need that boolean but you may find another use for it!

edit: Another benefit of wrapping User Widgets is that you can now easily stylise those checkboxes so they stay uniform throughout the menus. Makes maintenance / adjustments a breeze.

4 Likes

hi bro,why my Call ED My States has no State and Check Box Reference?

When you create a custom event dispatcher, you must add the data types you want to push through.


what type should I set to this parameter?

CustomCheckbox