Announcement

Collapse
No announcement yet.

Driving the colour of a text within a widget when a button is hovered

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Driving the colour of a text within a widget when a button is hovered

    Hi all!

    I'm creating a UI which has different buttons, and each of them contains a text as a child. The idea is that whenever the player hovers over a button, the colour of the text will change.

    In order to achieve this, I'm using a function that looks like this:



    It works as explained above, however there's something I'm not happy with. I don't want to create a unique function for every button that I have, I would like to create one that works for all of them. Any ideas on how to do so following the same logic? In my head it would be easy if I could somehow query the engine: tell me which element am I hovering over, and use that to drive the branches that I have in place and the colour and opacity. However I don't know how to do so, and therefore I'm creating at the moment one function per button.

    Thanks for your time, here's hoping there's an easy solution!

    #2
    Wrap the button and text in a widget. It will then become a custom widget you can populate your menus with. Since the button and text are a standalone widget now, you can use onMouseEnter/Leave to trigger the change of colours. No functions necessary.

    Comment

    Working...
    X