How can I clear the background color from a popup brought up by a menu anchor?
I just want the background color to be transparent, but I don’t see an option to clear the background color in the menu anchor’s Details panel.
I made Round shape border widget, but menu anchor made a box background automatically.
Having the same issue although in my case the background is grey. I have nothing that looks like it and I can’t find a way to turn it off. If I put the same widget somewhere else without using the anchor menu, the background is gone.
Ran into the same problem upgrading 4.27 widgets to 5.1 today as this broke our whole UMG screen setup.
It seems like, that if u want to use application menu stack, you’re forced to live with the background image enclosing your menu content.
This is a change/regression from 4.27->5.X, as they hardcoded to use fixed overlay images behind the actual menu content, when using the menu stack (see Engine\Source\Runtime\Slate\Private\Framework\Application\MenuStack.cpp:115)
Left side is 4.27, right side is 5.1, with newly added solid background
In comparison, in 4.27 they just added the menu content directly to the containing widget, allowing us to customize the appearance as we liked.
Not too sure, why they decided to do this, however without changing the engine source code, we’re stuck with this behaviour. You could overlap the background with a solid background of your own inside the menu content widget, which stretches to all edges, but this is not solving the problem in the first place.
Afaik not using application menu stack for the menu anchor is the only way to currently have full control over the widget design, e.g. having the background transparent.
I am a bit late to the party, but a possible solution without losing the advantages of the menu stack is to walk up in the slate widget hierarchy and hide the images. Example code:
void UMyEpicFunctionLibrary::RemoveMenuStackBackground(UWidget* Widget)
{
if (Widget == nullptr)
{
return;
}
SOverlay* FirstOverlay = nullptr;
for (TSharedPtr<SWidget> SlateWidget = Widget->GetCachedWidget(); SlateWidget.IsValid(); SlateWidget = SlateWidget->GetParentWidget())
{
if (SlateWidget->GetType() == "SOverlay")
{
FirstOverlay = static_cast<SOverlay*>(SlateWidget.Get());
break;
}
}
if (FirstOverlay == nullptr)
{
return;
}
FChildren* ChildrenPtr = FirstOverlay->GetChildren();
if (ChildrenPtr == nullptr)
{
return;
}
for (int32 i = 0; i < ChildrenPtr->Num(); ++i)
{
TSharedRef<SWidget> OverlayChild = ChildrenPtr->GetChildAt(i);
if (OverlayChild->GetType() == FName("SImage"))
{
SImage* Image = static_cast<SImage*>(OverlayChild.ToSharedPtr().Get());
Image->SetVisibility(EVisibility::Hidden);
}
}
}
Unfortunately it does not work in OnConstruct yet, because the slate widget does not have its parent set. One frame delay would lead to a visual glitch. After some debugging I found a glitch free solution:
Set the widget to Focusable
Call the function from NativeOnFocusReceived (C++) or from OnFocusReceived (BP).