x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

UMG - Text block color change on hover

I have a widget blueprint with a button (with alpha channel set to 0, so it's transparent) and it has a text block. I'd like to modify the text block on hover of the mouse. How could I go about this?

I am in 4.4.3 and cannot change to 4.5.1 because it scraps my game. Thanks for any insight

Product Version: Not Selected
Tags:
more ▼

asked Nov 09 '14 at 03:12 AM in Blueprint Scripting

avatar image

Madvoyer
101 15 18 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hello Madvoyer,

Have you tried using the "On Event Mouse Enter" node. Make a widget blueprint with just your button and this will allow you to fire off what ever event it is you need when the mouse is hovering. There is also a node called "Is Hovered", this returns a boolean value. I hope this helps.

Make it a great day

more ▼

answered Nov 13 '14 at 06:45 PM

avatar image

Rudy Q ♦♦ STAFF
47.5k 545 132 522

avatar image John Alcatraz Apr 17 '15 at 03:30 AM

I know this is old, but there is still no better way to do this? The problem with creating a new widget for just one button is that if you have many buttons you need many manually created widgets because each widget needs to do it's own stuff in the "OnClicked" event. If you have many normal buttons in a widget you can just have all the "OnClicked" events in your one event graph, but if your button is inside a widget, this does not work. And for defining individual behaviour on "OnClicked" there has to be one widget blueprint for one button, so this means if you have 10 buttons you need to have 10 widgets in your content browser.

I guess you get this is not really a comfortable solution?

I know I also could do it with the isHovered Node, but then I would have to check every tick whether any button is hovered and compare this to whether he was hovered the last tick to basically get "OnEventMouseLeave". A lot of unnecessary stuff in the tick, which is not good.

avatar image Rudy Q ♦♦ STAFF Apr 17 '15 at 02:11 PM

Hello John Alcatraz,

If you would like to accomplish an on hovered event with out the use of a tick and still have the use of your OnClicked event you would simply bind a new Onclicked event to the button after it has been add to the second widget. I have provided an example below. I hope that this information helps.

Here I created a new widget that will hold my button that I would like to have the "Hovered event" for. It's a single button and a canvas panel for this example. The canvas panel has been resized to fit the button to make for an accurate "Hover" effect.

alt text

Here is the event graph for my button widget (The widget is named ButtonTest). I am using an On Mouse Enter Event to simulate the fact that the mouse is hovering over the button. In this case it is a simple print string that lets me know when I am over the button.

alt text

Here I have added the button widget (ButtonTest) twice to another widget (in this case it was left as the default name "NewWidgetBlueprint")

alt text

Here is the event graph for "NewWidgetBlueprint" this is the widget that will be added to the screen. As you can see here I have pulled out a reference to the button from "ButtonTest" and I have bound new click events for each instance of "ButtonTest" that has been add to "NewWidgetBlueprint". On Event Construct these new OnClickedEvents will be applied to each of there corresponding instances of the button from "ButtonTest"

alt text

Make it a great day

avatar image John Alcatraz Apr 17 '15 at 04:45 PM

Thanks a lot Rudy, works really well! Just a big ugly to have all these Event delegate wires, but I can live with that :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hope this helps anybody else coming here from google. Make your text a variable, then create a set color and opacity node by right-clicking (for some reason it doesn't appear in the list when dragging from your 'Get TextBlock') then just link the 'Get TextBlock' (or whatever you have titled your text) to it.

capture.png (178.6 kB)
more ▼

answered May 08 '18 at 12:11 AM

avatar image

Dale122
6 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question