How to change the opacity of any button in a Widget, when hovering it ?

k_Rave
Sun, 11 Nov 2018 20:41:49 +0000
UI

Hello,

I’d like to ask :
Does anyone have any solution to make any hovered button’s opacity 1 and all others 0,7, in a Widget ?

Here’s the way I do it :

Then, when I don’t hover it anymore, opacity goes back to 0,7.

Remark : The button’s background color is completely transparent, so I can change the button’s Color and Opacity’s Alpha, it’d do the same

Well, that’s for the basic buttons of the menu, but then, the Continue the Options buttons call a WidgetSwitcher and we have to do the same opacity handling stuff with many more buttons. In the end, the graph would be so long for a simple and repetitive task I can’t believe there is no better way to do it.

I could think of a few different solutions :

Widget’s Tick calling a ForEach (Button b in self) → change b’s opacity if Hovered.

Get Hovered element(s) in Widget, then cast the element(s) to button and change Opacity if cast done successful.

For these two solutions, keep in mind that we have to reset the button’s opacity to 0,7 when Unhovered (with tick affecting 0,7 if not hovered or with temporary reference maybe).

Overriding/Redefining the On Hovered (and then On Unhovered the same way) event in Type Button (or only this Widget’s buttons if it’s possible) to change the button’s opacity On Hovered’s calling.

Thanks a lot !

PS : If it could help, here’s a part of the concerned elements my Widget Hierarchy (then there are also buttons in Resolution and in Keyboard)

5 posts - 1 participant