How would one make a context menu in UMG c++ or Slate in game

As the question asks, I would like to know what is the approach (or best approach) to creating a context menu (right mouse click on other UMG/slate widgets) in game in UMG preferably but Slate with UMG interaction is fine too, c++ or blueprint.
I’ve been trying a few things with more or less success so far, some solutions better than others, but still lacking in functionality.

So the first thing i tried was a completely blueprint solution, detect right mouse down, spawn a UserWidget blueprint widget on the viewport at the mouse location. The problem with this is a can’t detect click outside the widget in order to close it. Tried a few things like having a transparent fullscreen overlay behind it, detect click on it, destroy the widget and overlay. A problem with this approach, somehow mouse focus is lost to game viewport, and the widgets behind the overlay are no longer responding to mouse events (ex roll over buttons) even if the mouse events callback return unhandled replies, and use onpreviewmousebuttondown.
I also tried registering to FSlateApplication.PopupSupport.OnMouseclickoutside. It never triggered…

A second thing i tried to use UAnchorMenu widget object, to create it dynamically and place it at cursor location, set the content and call setisopen on it. Problems with it it is not closing automatically on click outside. When the anchormenu object is placed inside the current widget, the popup appears also inside, and gets hidden by other widgets. Didn’t try putting it directly in the viewport instead, since it wasn’t closing automatically, although i saw in the smenuanchor implementation it is binding to on mouseclickoutside event.

I also tried FSlateApplication.PushMenu - i had the most success with this one, the popup closes automatically when clicking outside, widgets behind this new window (PushMenu creates a new SWindow, is this ok for use inside a game, in SWindow i saw reference to native window…) keep responding to mouse events. All good… Except, my widget pushed seems to be losing its transparency, and instead the background is opaque black. I Looked through PushMenu implementation and saw that the new SWindow object has useTransparency only if animations are turned on and slate application not throttling, however the window is animating, sliding in from a right offset at the position it supposed to be, still the background is black.

I think i tried a few other things, each with problems of their own, however these are the most important i guess.

I am currently on 4.5 preview, moved from 4.4 where even to detect right mouse button down in UMG i had to go through hoops.

Any pointers, suggestions regarding this?
Thanks in advance

I’m wondering the same thing.

Here’s our answer: Slate UI: Dynamic Menu? - C++ - Unreal Engine Forums

UMG probably isn’t going to have the support for one for a good while, so I am working on making a UI library using C++ and Slate where you can easily make drag and drop-able windows, context menu, message boxes, etc. The link above is what I used to get started with a context menu, Hope it helps.