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.

2 Likes

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

Hello! I’m a bit late, but I ran into this issue just recently, and I have a different vision.

What I want is for up to a certain number of slots to be selected. the number of slots to be selected can be increased over time, and upon reaching that slot number limit, I had two options for UI functions:

  1. The first slot you selected will toggle off and be replaced by the most recent slot you toggled on to keep the number of slots filled.

OR:

  1. You cannot select anymore slots, until you reverse the toggle on any other slots you’ve previously toggled.

I’m guessing number 2. is more easier and doable, what do you think? what to do to get these results/ functionality?