Using Keyboard Control in a Widget

Ok, this is how I have done it. Not sure if it is the correct way, but this way will remove all widgets from your viewport.

Character Blueprint: Screenshot - 2a23c2794831f2817a0ddffe958b5b6c - Gyazo

We are basically saying, when we press the “M” key, open the main menu widget, add it to the viewport and show the mouse cursor, when we press the “M” key for a second time, we simply remove all widgets from the screen and hide the mouse cursor.

Hope this helps!