Changing Color of Border in Widget on Mouse Press

Hi Guys

I have an inventory system which has a grid which contains a number of Inventory Slots (slot widget). What I’m looking to do is when I click on one of the Slots, I want to change it’s border color and if I then click on a different Slot, it reverts the previous one back to the original color, and then changes the color of the new slot.

I am able to change the color on mouse press no problem, however not sure how to change it back when I click on another slot. At the moment, every slot I click on changes color to the new color without the previous one reverting back.

Any Ideas?

Thanks.

Depending on your setup you maybe able to use a simple int array to save costs, and depending on your slot style this may or may not be a solution, but you get the basic idea, for all occupied slots set colour based on a simple branch/if statement, when you click on a slot set it to the active int,

demo.JPG

Thanks for the tip. I will give this a go and see how it works out.