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"

Hide Widget when pointer is out of the widget size

I have made a BP with mesh in it When user clicks on mesh It shows a widget asking user to select which color does he wants to select

What I want to do is, as soon as I end hovering my cursor in the main area of the widget the widget should disappear.

I do not want to hide widget as soon as user selects a color, I want to hide widget when user's pointer is outside the widget size. Also please note that my widget space type is SCREEN and not world. I know that I could have user ON HOVER END event, but this works only if the widget space is WORLD and does not work in SCREEN!!

Please help

Product Version: UE 4.17
more ▼

asked Sep 15 '17 at 01:56 PM in Using UE4

avatar image

70 6 8

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

1 answer: sort voted first

If you are using a WidgetComponent (3d widget), you should be able to use OnEndCursorOver to achieve this. You'd need to implement in on the component, not the widget. This is the equivalent of OnMouseLeave for 2d widgets.

more ▼

answered Sep 15 '17 at 02:27 PM

avatar image

13.7k 74 25 57

avatar image A.SISODIYA Sep 16 '17 at 02:03 PM

Everynone >> How do you suggest should I use this OnMouseLeave for the 2d event. I mean should I use it inside my UI BP, or actor BP please do help me out :) Also please note my UI is 2D and there seems to be no event in my canvas or Border component named OnMouseLeave , I do have OnUnHovered in my Button Components which seems inappropriate to be used as i don't want to exit as soon as I unhover my button.

I want to exit when I leave my main area

avatar image A.SISODIYA Sep 16 '17 at 02:09 PM

Never Mind my friend I have figured it out and it did work out pretty well. Thank you!!! To people who have same problem you can add OnMouseLeave Event inside you widget BP. Please note that if you are unable to find that event inside BP. please uncheck "Context Sensitive". And then try to find this event :)

avatar image Everynone Sep 16 '17 at 02:26 PM

It's in the override menu, as shown below. And glad you made it work!

avatar image Everynone Sep 16 '17 at 02:22 PM

In you original post you mentioned World and Screen settings. These are used when embedding a widget in a component and making it a part of the 3d world, that's why I suggested OnEndCursorOver:

alt text

When talking about 2d widgets, you will want to utilise OnMouseLeave. Please note that you can only override this function for the entire widget. You cannot simply select a border and detect cursor sliding off it. To be perfectly honest and if I remember correctly OnMouseLeave is detected when the cursor leaves a Visible part of the widget. So if you have a Visible image wrapped in a SelfHitInvisible border, you will be able to detect leaving Image area. But I digress.

Correct me if I'm wrong, but I believe you have a big UI element with some other parts in it and you want to detect cursor slide of it. Consider adding and image to clarify, this usually helps a lot.

If you want to have UI cover a part of the screen and need to react to cursor leaving some part of it, use custom widgets. And then insert then into a parent container. This way you will have a self-contained OnMouseLeave logic bound to a custom the widget:

alt text

untitled.png (61.6 kB)
untitled1.png (36.6 kB)
avatar image A.SISODIYA Sep 16 '17 at 04:12 PM

Yes thank you for your answer and elaborate explanation! I had no idea that we can use override function to do so.Your answer surely helped me a lot. And yes I have added my UI inside another widget in a container :). To be on safe side i have also added another image with alpha set to 0 behind my desired UI.

(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