Change visual of Widget dashed border

Hey,

I have create a menu with umg with most logic in c++ that I control with my gamepad but I want to change the look of the dashed line that you see when you select/navigate through the widgets (defaulted to the TAB button I believe) but I can’t figure out a way to do this.
Can anyone help me with this, or point me in the right direction of where to look for this information?

TY!

1 Like

Hi,

To disable the dashed border or modify its behavior you can go to Edit → Project Settings → User Interface and then look for Focus → “Render Focus Rule” (as of UE 4.8).
I think it’s meant for development purposes only as there aren’t any options to modify how it looks, so you might have to implement your own focus visuals.

This is directly from the enum definition in code:

/** Focus Brush will always be rendered for widgets that have user focus */
Always,
/** Focus Brush will be rendered for widgets that have user focus not set based on pointer causes */
NonPointer,
/** Focus Brush will be rendered for widgets that have user focus only if the focus was set by navigation. */
NavigationOnly,
/** Focus Brush will not be rendered */
Never,

You could also directly modify it in code if you’re building UE4 from source, you’ll find the drawing code in SWidget::Paint implementation:

bool bShowUserFocus = FSlateApplicationBase::Get().ShowUserFocus(SharedThis(this));
if (bShowUserFocus)
{
	const FSlateBrush* BrushResource = GetFocusBrush();
	if (BrushResource != nullptr)
	{
		FSlateDrawElement::MakeBox(
			OutDrawElements,
			NewLayerID,
			AllottedGeometry.ToPaintGeometry(),
			BrushResource,
			MyClippingRect,
			ESlateDrawEffect::None,
			FColor(255, 255, 255, 128)
			);
	}
}

FColor is the dashed line color.

Thanks a lot that was exactly what I was looking for :o)

ZenithSal’s answer helps a lot. My UE version is 4.27 and I notice that we can use the static method “FCoreStyle::SetFocusBrush(NewBrush)” to change the focus style.

1 Like