# UMG Toggle Buttons

**URL:** <https://forums.unrealengine.com/t/umg-toggle-buttons/227052>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4-26\
**Created:** [April 29, 2021, 9:46am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052 "2021-04-29T09:46:43Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![KngParadox](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kngparadox/32/953256_2.png) [@KngParadox](https://forums.unrealengine.com/u/KngParadox)\
**Post date:** [April 29, 2021, 9:46am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/1 "2021-04-29T09:46:43Z")

</div>

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”

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/b/5/b5d21704e203bad3a5ff7df5c90bcb5500e7b41c.jpeg)

**Solution by :** [ClockworkOcean](https://forums.unrealengine.com/u/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.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 29, 2021, 10:22am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/2 "2021-04-29T10:22:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![KngParadox](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kngparadox/32/953256_2.png) [@KngParadox](https://forums.unrealengine.com/u/KngParadox)\
**Post date:** [April 29, 2021, 10:32am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/3 "2021-04-29T10:32:50Z")

</div>

Thanks, now need a tip to locking buttons when checked 😃

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [April 29, 2021, 10:35am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/4 "2021-04-29T10:35:31Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [April 29, 2021, 10:56am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/5 "2021-04-29T10:56:06Z")

</div>

For the second one: Bind the “IsEnabled” variable to a function that sets whether it should be enabled or not:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/a/4/a4735f062163cc3c93888cfc904f1b92e7cda978.png) → ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/b/d/bdd1f1b95fbe68a337a82936001f93913138faa1.png) →

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/8/c/8c69d2091cd9fb20c4c77a6c3fc23aac7e57c262.png)  
This enables and disables the button every second.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 29, 2021, 11:22am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/6 "2021-04-29T11:22:20Z")

</div>

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:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/a/0a28643c6e39b5b34b514ec8833d254dc2aff376.png)

And in the main widget holding checkboxes:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/a/a/aa33c94b2a547e75b74eae4c722002ae1f63a7b9.jpeg)

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.

---

<div class="post-metadata">

**Author:** ![shiki\_2019](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shiki_2019/32/546483_2.png) [@shiki\_2019](https://forums.unrealengine.com/u/shiki_2019)\
**Post date:** [October 1, 2021, 9:24am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/7 "2021-10-01T09:24:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 1, 2021, 9:33am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/8 "2021-10-01T09:33:15Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/4/2/42298cba45eb0427631ba159155f763849802598.png)

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

---

<div class="post-metadata">

**Author:** ![shiki\_2019](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/shiki_2019/32/546483_2.png) [@shiki\_2019](https://forums.unrealengine.com/u/shiki_2019)\
**Post date:** [October 25, 2021, 3:33am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/9 "2021-10-25T03:33:34Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/3X/4/b/4b7a8194197524534f6104267c3bf63843142fb6.png)  
what type should I set to this parameter?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [October 25, 2021, 6:58am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/10 "2021-10-25T06:58:18Z")

</div>

CustomCheckbox

---

<div class="post-metadata">

**Author:** ![Tettey\_Nartey](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tettey_nartey/32/882427_2.png) [@Tettey\_Nartey](https://forums.unrealengine.com/u/Tettey_Nartey)\
**Post date:** [July 30, 2024, 3:25am UTC](https://forums.unrealengine.com/t/umg-toggle-buttons/227052/11 "2024-07-30T03:25:41Z")

</div>

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?
