Changing a text color on a button in a scroll box when clicked.

I imagine that this would do it. It’s kind of dumb that there is no “GetAllChildren” for a scroll box, but this is basically that.

I have an inventory made up of a scroll box and inventory slot widgets inside of it showing the item and quantity. What I want is to click on an item and the text color change then when I click on another item the text go back to normal on the previous item and change color on the new item I clicked.

In the past if I had buttons that were not part of a scroll box and I wanted to do this, I would select all the buttons and reset to default color and then change it on that one button to a brighter color. Each time you selected another button the color would go back to normal and that button would change to brighter. I am having issues selecting all of the buttons in the array to do this.

Any tips?

Looks like something I was trying to create, cannot get it to work though. Stops at the for loop.

Here is what I have, most likely I messed it up. I even with a few items in my inventory I just get a “Loop Completed” string and never get a “Looping” string. My Inventory widget it “InventoryMenu” and it contains the scroll box “InventoryScrollBox”. The “Inventory Slot” widget is the button added to the scroll box containing the items.

I’m not sure why it’s not working. The following setup is working for me, it’s looping 3 times then finishing.

Try printing the return value of Get Children Count and see what it says.

87147-2.png

If I add the widget (Children) to the scroll box as you did, in the editor it will come back with the number of children I added using that method. I am adding the widgets (Children) in game to the scroll box at pickup using an array. It is not recognizing them as children apparently.

I just tried adding a widget to the scrollbox the same way you did, but it still shows up in the loop. I’m not sure why its not working on your end =/

I made a new project with a quick simple code and it still is not working :-\