Check Box Problem/Bug?

@[Everynone]

That’s a great way to make the buttons. Thanks for sharing that. I haven’t fully understood it yet, but I’ll keep working on it.

One problem though … you still can’t scale the checkbox without it messing up. Go back into your customCheckboxText widget and scale the checkbox up. You’ll see the problem.

Looks as I expected it to after scaling:

Bad. You’re not supposed to scale it like this, though - use styles:

Also, important for UI:

Aim at making them white with transparency - easier to work with them later on.

1 Like

@Everynone

When you scale yours, it stays in the box. When I scale mine, the left part of the check box ends up outside the box. Maybe this has something to do with the ‘borders’. I’ve never used them before, so maybe I set it up wrong.

As above, do not use Transform Scale - it will not conform. Use styles:

image


Scaling will work but you’ve asked the widget to just scale up (from its centre outwards) - if you do, you must also ask it to move:

But don’t, it will probably just overlap. Consider working with Image Size and ensure the image you’re using is large enough.

As soon as you start fiddling with scale, and translation in general, the Desired Size of the widget is no longer reported accurately (I mean, it is, but not to the human eye, it is not); other elements and the parent container depend on it for the layout.

UMG is not pixel perfect everywhere.

1 Like

PERFECT. :wink:

1 Like

@Everynone

OK, Very much appreciated. I got it to work both ways. The first way by adjusting the padding on the border.

And then I tried messing with the styles and got that going too. The only problem I see with doing it with styles is that you have to set the size half a dozen times. Once in “unchecked Image” again in “uncheck hovered image” and “unchecked pressed image” and “checked image” etc…

Either way, I very much appreciate your help. I would never have thought to make one reusable widget like that. Good stuff. Thanks for sharing.

Imagine setting style numbers for a bunch of widgets separately - madness. But if you’re planning something with scope in mind, you do not want to do things manually - you create and configure slate brushes & styles:

And then use them throughout the interface. You can apply them to elements in loops, without ever punching more than 1 number.


But that’s a story for another day - the rabbit hole. How much automation is needed really depends on what the long term plan is.

Do I spend 1h connecting wires 1-by-1 now - a.k.a. the carpal tunnel with extra steps. Or spend the next 10h making a system that automates it?

My personal ratio is 50-50 for choosing the wrong thing. So there’s that.

Ah yes, the Minecraft dilemma. Do I spend an hour gather the resource or do I spend 10 hours designing and building a machine to automate the production of the resource? I’m not going to lie, I make the machine.

… but I think I’ll leave slate brushes for another day. My menu system doesn’t need any more check boxes (… right now anyway.)

1 Like

@Everynone

OK big problem. With the button set up in this way, I can no longer get the “On Check State Change” event. They look nice, but if I can no longer use them …

As mentioned above - dispatch it. Depends on what you really want do. Do you want to drag them one by one or do you want to perform special actions in bulk? I’ll give you an example.

  • the most straightforward way:

  • so the main widget can catch it:

There are better ways, though.

A much better solution (might be scenario specific) is to equip the Event Dispatcher with more data:

  • each checkbox can be configured to do something specific:

Above, the custom checkbox + text widgets holds onto an enumerator that describes its purpose.

  • this is then dispatched:

image

  • and caught in the main widget:

You could even add a self reference so the owner knows precisely which checkbox widget was ticked.

selecting different aspects of difficulty, number of enemies, quality of their armor

I’d add an enumerator for those and an int as a value.


Note that the amount of script would be the same for 2 or 200 checkboxes.

I think the first way might work for me. I didn’t take it to a fully functional test yet, but I’ve got the ED_My State event showing up on the buttons. I don’t want to waste a lot more time on it because I’m thinking I’m going to have another issue when I try to use that event to uncheck other checkboxes.

The “much better” doesn’t seem to because I don’t have the “Action for This Checkbox” option and can’t figure out how to create it.

Either way, I think I’m better off going back to my original

[Checkbox]
____[Text]

method now that I can change the size of the check box with the styles and not mess everything up. This gives me the event I need without all the extra code, (event dispatchers and such). All I need is to have boxes 1, 2, and 3 unchecked when I check box 0 or 12, 13, and 15 unchecked when I check box 14, that sort of thing (and set variables once apply is clicked). No need to get super fancy.

I appreciate all the help. I learned a lot about this stuff that I didn’t know before. I’ve put off making a menu for a long while now and I’m glad to finally be getting it done. I want hurry up and get it finished so that I can go back to the fun stuff.

1 Like

In case you ever decide to revisit this:

It’s an enumerator you create yourself and add as a variable to any blueprint:

  • the checkbox widget could have one and some value:

  • those values can be then configured in the parent widget scrollbox:

  • so I’d normally handle it like so to keep the graph clear:

Ticking the Epic Loot checkbox sends the scrollbox widget a message with value 5 - this will also tick (or untick) something else; here, it’d enforce Difficulty.

because I’m thinking I’m going to have another issue when I try to use that event to uncheck other checkboxes.

I’d say quite the opposite. It’d would simplify things greatly. But ofc, you look at the size of what you’re making vs time it takes to set it up + the upfront cost of learning something that may not be that useful and choose the best tool for the job!

Good luck!

I think I’ll follow through with it, mostly because I don’t want to rebuild all 22 checkboxes for a 4th time … and, you know, because I like to learn. Most everything I’ve done in Unreal so far is about learning rather than making a game. I tend to try to find the most difficult thing I can think to try, and then try it. And now I’ve got a whole slew of cool mechanics that are begging to be turned into a game. This project is my first attempt “make a game” so I’ve never really had much of a need for a menu until now.

Anyway, I’ll try to finish incorporating that method tomorrow night. I’m about to get off work and go home to bed.

I’m glad I happened upon your path tonight.

1 Like

And there’s always a chance for the Game 2 at some point.


Also, I left this link before but deleted it, thinking it might be redundant but if you ever need exclusive checkboxe list that allows only for 1 pressed element:

I was trying to implement the setup you provided in the link above (UMG Toggle Buttons). In the first picture from your post there you have a reference to self being input into the dispatcher. How are you doing that? What type of variable did you set up in the ED? I setup a variable of type ‘check box’, but I can’t attach a reference to self to it.

Self is the entire widget, the whole thing, this instance. So you’d set the type to that widget.

If you set it to the native checkbox, you’ll be only able to send this widget’s checkbox.

Kind of busy last night, so I didn’t have a chance to mess with this much, but I’m back on it tonight. I’m still trying to implement the method you shared in UMG Toggle Buttons - #6 by Everynone. More importantly, I’m trying to understand it … and more or less I’m getting there.

Ignore this part: I figured it out
{
However, I’ve encounter another problem. In the second pic, you have a custom event called ED_MyStates_Event_0. I can create a custom event, but I can’t add the “Check Box Reference” to it, which makes me think this is not just a custom event I create there on the spot. I don’t know how to make this node.

Where is the “lastChecked” set up?

Ok, got those things figured out and this mess sort of works. I can click one checkbox and it checks. I click a second box and the first one unchecks. Yay … until I click a third one. The second one does not uncheck. Clicking a forth leaves 2, 3, and 4 checked.
}

Also, is it possible to set a “default”? I’d like the first box to be checked automatically.

Also, in the interest of understanding things: In the wCustomCheckbox you’re calling the ED_My_States and passing the Is Check value to it, but then not using that value on the Custom Event in the main widget. I’m curious about that.

I’ll play around with this stuff and hopefully figure it out. I’m still not nearly 100% on the understanding of what’s going on here and that bugs me. I don’t want to just copy what you did, I want to understand the why of it.

Thanks.

Yes; create a new Instance Editable variable in the checkbox widget and hook it up to the pre construct:

It cab be then set for each instance of the user widget the scrollbox holds:

It’s the same approach as with typing in the exposed text in the first post with images:

Looks like I already do it here but never talk about it.


you’re calling the ED_My_States and passing the Is Check value to it, but then not using that value on the Custom Event in the main widget. I’m curious about that.

Nice catch. It’s not used, the comment right below the anim it refers to that very boolean:

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

I have a working system now. I’ll admit that I didn’t do it the way you showed. Your way is probably better, but I didn’t understand it well enough to be able to tweak it as necessary.

I understand event dispatchers (or at least I thought I did) but I didn’t fully understand what was happening with them in this context. I think it’s more a matter of not fully understanding widgets and check boxes. Still, I learned enough from your examples to come up with my own system (that doesn’t use EDs), so I’m going to call that a win. Perhaps I’ll revisit this topic and method at some point in the future, when I have a better understanding of things. Right now, it was like trying to learn too many new things at once. I need to go one piece at a time.

Your help has been much appreciated. While I didn’t use that solution, I did find a solution thanks to your guidance.

1 Like