How can i manually set a button widget to hovered state

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.

1 Like

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!

230027-ue4editor-2018-02-08-23-14-17.png

1 Like

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