UMG mouse issues

(UE4.6 BTW) I’m trying to create a dialog menu system so that when the user “interacts” (defaults to right click) with a character, it will open up a menu. Before I try to do anything useful, I’m trying to get the basics down. So I created a simple menu that just has one button designed to close the menu.

The issue I have is that the mouse is not locked to the viewport and I can’t get rid of it after the menu is closed.
My common script in all attempts are interact->create widget->add to viewport
First I tried a separate show mouse cursor on get player controler 0.
In the widget the button removes the widget and reverses the show mouse controller. No luck the mouse is not bound to the window and is still visible afterword.

Then I tried changing show mouse cursor to set input mode UIOnly. I actually like this better as it forces you to complete the dialog before you can do anything else. Unfortunately it has the same problem. It correctly returns control back after close, but the mouse is still there.

In both cases if you click anywhere but the button, it vanishes. The mouse shouldn’t vanish until the dialog menu is closed.

ok now randomly for no reason at all the mouse is disappearing with the menu closing. I swear I didn’t change anything. Now my problem is that if I click anything but a button, the mouse vanishes. I have to get it back by hitting the windows key.

Hello awilliams1701,

I was unable to reproduce this issue. Would it be possible for you to provide a screen shot of your blueprints? This way I can see how it is you have your “Set show mouse” nodes set up.

The only issue I’m still having is that if you click on anything other than the 2 buttons (one is a dummy that does nothing) the mouse disapears. However I noticed that the “Lock Mouse to Viewport” checkbox does nothing. In the screenshot its off, but even if its on it doesn’t actually restrict to the viewport. I’ve tried both the main viewport and a new window.

Hello awilliams1701,

Have you tried setting your “Set Show Mouse Cursor” node to True after adding your widget to the viewport? You could then have it set to False when the widget is removed.

I’ve done that too. From what I can tell there isn’t much of a difference between “set input mode uionly” and “show mouse cursor” other than you can’t move anymore. In both cases it actually releases the mouse from the window but it will still interact with the UI, but it will go to the desktop at that point no problem. If I make the mistake of clicking on the in game rendering rather than one of the buttons, the mouse vanishes and there is no way to get it back short of hitting the windows key or ctrl+esc.

Hello awilliams1701,

I was able to get this working using the following blueprint.

Hello awilliams1701,

I haven’t heard back from you in a few days, so I am marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and I will offer further assistance.

Make it a great day

Took a while for me to be able to test this because until now my project had been crashing on launch. Apparently this sequence really makes the difference.

BTW: this engine hates objects with circular references. That’s why it was crashing on launch. I had to remove and alter one of my blueprints to fix the issue.