The other way to do this, rather than using buttons is to use checkboxes. They’ve already got support for the different state visualizations, all you have to do is change the “CheckBoxType” style option to be Toggle Button, which repositions the content, makes it layout more like a button, but still function like a checkbox/toggle button.
Yeah, but You cannot construct checkboxes so You need add them anyway to other widget.
Then You need to create many of them depends on names and still control states (changing all with loop) using some index.
So it would be almost exactly the same solution.
Went through the whole thing… seems to work… but I call that widget from a different menu… if I go in and click on things and apply, it changes settings, and saves. If I leave game and come back the settings are restored correctly.
But if I go and change and apply settings, then leave that menu (hud) and go back in again without quitting the game, I get random results for what the buttons are selected as, sometimes resets them all to low.
How do You leave from that menu? Simplest way is just use visibility hidden / visible when use (Close) button.
Even if You remove widget from viewport, create new widget and add it to Viewport, settings should be the same, because onConstruct there is loading from the file.
EDIT: You was right. If You use package project and destroy gameHud Viewport every new widget (radiobuttonLine) will get new index.
For correct working You just need:
create Your viewport once and use hidden / visible.
Like I did in my project. Use ID variable for every radiobuttonLine and set it manually 0-5:
Yeah, with my menu’s I generally do a check on first call to see if it is created, if not, I create the new widget, if it already exists, just change visibility. I had not done that with this one as I was just testing, and it was creating it each time. So I went back and set it up like my other menus and it works like a charm… here is my ‘show’ for that settings menu… then I have a hide event that just set’s it to hidden when you return from it.
I know this is an old topic. In many GUI Frameworks, there are ButtonGroup widgets usually used to organize check boxes and radiobuttons into exclusive groups. see also Group Box Example | Qt Widgets 5.15.13
Because radiobutton is exclusive, and pressing a checked radiobutton should not change checked state, so in UMG(UE4.21) we can’t use a checkbox as a radiobutton directly.