# Hide Widget on Click

**URL:** <https://forums.unrealengine.com/t/hide-widget-on-click/322296>\
**Category:** UI\
**Tags:** unreal-engine, UI, Widget, Blueprint, question\
**Created:** [June 18, 2015, 6:39pm UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296 "2015-06-18T18:39:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdeni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mdeni](https://forums.unrealengine.com/u/mdeni)\
**Post date:** [June 18, 2015, 6:39pm UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296/1 "2015-06-18T18:39:26Z")

</div>

Hello!

I want to make simple thing:

1. When I click on the some object, popup widget will be shown on the screen.

2. When I click on buttons from this widget, some things will be done and widget will be hidden.

3. When I click on empty place, just widget will be hidden.

Like this:  
 ![pic1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/6/7/6674698cdffe8238c835b7ef6e737232ef46a57b.png)  
Press on (1), Hide (2).

But I cant do the third point. Since widget has no any mouse events.

 ![pic1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/f/5/9f529c80df213cb8e952c6391b031609c95ee06a.png)

Help me please 🙂

---

<div class="post-metadata">

**Author:** ![luccasclezar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@luccasclezar](https://forums.unrealengine.com/u/luccasclezar)\
**Post date:** [June 18, 2015, 7:02pm UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296/2 "2015-06-18T19:02:09Z")

</div>

Inside the UMG editor, click on a button of your widget, all the way down of the details tab is a “Events” tab with some events (lol), click on the “+” button of “OnClicked”. You’ll go to the Event graph, now just create the logic of that button (what will happen On Click) and make sure the last node is “Remove from Parent”.

The “Remove from Parent” is a node called to remove the widget from the viewport.

Hope that helps! 🙂

---

<div class="post-metadata">

**Author:** ![mdeni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mdeni](https://forums.unrealengine.com/u/mdeni)\
**Post date:** [June 19, 2015, 6:20am UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296/3 "2015-06-19T06:20:38Z")

</div>

It doesn’t help. Look at the top picture. I don’t want to press the button. I want to click in any empty place and hide the widget.

---

<div class="post-metadata">

**Author:** ![luccasclezar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@luccasclezar](https://forums.unrealengine.com/u/luccasclezar)\
**Post date:** [June 19, 2015, 6:59pm UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296/4 "2015-06-19T18:59:01Z")

</div>

Oh! I see… Well… I never did any kind of logic related to that. The only way that I think of, is to add a transparent button to the empty screen space and when clicked, remove the widget from parent. But this would not be a good idea, because if the player click on another structure, it will just remove the widget. But I think that you could start with this logic and improve it.

Sorry if couldn’t help. Good luck!

---

<div class="post-metadata">

**Author:** ![mdeni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mdeni](https://forums.unrealengine.com/u/mdeni)\
**Post date:** [June 21, 2015, 6:50am UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296/5 "2015-06-21T06:50:03Z")

</div>

Thank you 🙂 I had to change the logic behavior of the game.

---

<div class="post-metadata">

**Author:** ![KITATUS](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kitatus/32/983160_2.png) [@KITATUS](https://forums.unrealengine.com/u/KITATUS)\
**Post date:** [June 21, 2015, 8:16am UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296/6 "2015-06-21T08:16:10Z")

</div>

Hey! I just thought to let you know that if you question has been answered; Please “Accept” it as answer; It saves time for us moderators and makes sure the questions that need attention are seen to as soon as possible! Thanks!

---

<div class="post-metadata">

**Author:** ![mdeni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mdeni](https://forums.unrealengine.com/u/mdeni)\
**Post date:** [June 21, 2015, 11:09am UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296/7 "2015-06-21T11:09:48Z")

</div>

Hi, this is not answer 🙂 I still have not received a solution to the problem. This is just workaround for this question.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b9532c9a](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b9532c9a](https://forums.unrealengine.com/u/anonymous_user_b9532c9a)\
**Post date:** [June 21, 2015, 3:38pm UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296/8 "2015-06-21T15:38:28Z")

</div>

Actually idea is an extremely good one, there is one more addition that you want to throw in to make this work. When you press the invisible button, run a linetrace from the mouse location to the world. use a line trace by channel with a custom channel set to “selectable”. If the trace returns a hit, check to see if that hit was a selectable object, if true, run the selection functionality that you’ll have set up for things like buildings. if it returns anything else, just remove the widget from your parent as suggested. This will let you remove the widget with the caveat that if there is a selectable object, you select that instead of just removing the widget.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5ccb8dbf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5ccb8dbf](https://forums.unrealengine.com/u/anonymous_user_5ccb8dbf)\
**Post date:** [August 2, 2017, 6:41am UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296/9 "2017-08-02T06:41:46Z")

</div>

In your level blueprint, look for mouse events, this will be a global mouse event, it will detect when there’s a mouse click. From there, you can add conditions to hide your widget

![203520-mouse_event.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/2/6/e2640e487aa2ec02f2ce1d648b885bfcfd7c2710.jpeg)

---

<div class="post-metadata">

**Author:** ![jeremythuff](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jeremythuff](https://forums.unrealengine.com/u/jeremythuff)\
**Post date:** [March 14, 2019, 5:26am UTC](https://forums.unrealengine.com/t/hide-widget-on-click/322296/10 "2019-03-14T05:26:48Z")

</div>

#3 can be handled with an override of “On Removed From Focus Path”

I just achieved this using that node:

 ![271338-widget1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/9/f/a9fd0964781f5f94243fc31f3eb4c38e829151bc.jpeg)
