I noticed that they have events for when the widget is pressed or clicked, but not for hovered. I want to be able to change the buttons color whent he widget is being hovered (which works fine for mouse). but i want to be able to do this for a gamepad as well. I found a function that Checks if it is hovered, but not to set the value.
This is probs a bit late but for any one also looking for this as I was. I’ve just figured out how to do it, you have to get the button you’re trying to manipulate, get its current stytel and feed it to the set method. Just swap the normal and hovered state around. So normal set in set method is equal to hovered state in get method.
Please please elaborate…I’ve been searching for ages and it seems like you have the answer…if you can, please post a picture of your blueprint
This is how I did it. This is on the event constructed/begin play. I’m grabbing the default button and setting it’s style as my “DefaultButton” style, then splitting the out pin into a struct, and creating a second button style called “HoverButton” which I’m then feeding the “hovered” style portion from the default button style into the default portion on the new button style. This is giving me two style variables I can easily plug in whenever I need to swap the styles out.
Hope that helped! Thanks to Angel1630 for giving me the original idea. Worked perfect!
I attempted it this way but it did not work the way I intended, i believe this has something to do with a prior tutorial I went through in regards to using keyboard focus and switching the style of buttons, anyway this is what i was going for
None of the solutions using style worked for me. I couldn’t get the changes to reflect on the buttons. What I ended up doing was setting all the button state tints to
White and then just changing the color using
SetBackgroundColor. I unified the mouse and game pad code by overriding the
OnPressed events for the buttons and changing the color there in the same manner as with the gamepad path. I noticed that all of these applied a “tint” to the button which made me think color component multiplication so setting every other value to white and then just setting the background color had the desired effect.