How to receive OnMouseEnter for a Slate menu item? [Solved]

How to know when the mouse enters/exits a slate menu item created using FMenuBuilder::AddMenuEntry?
I want to do something when them mouse pointer hovers over the menu item and the menu item becomes highlighted.

OnMouseEnter() is virtual, you can override on your Slate class.

Wow, quick answer!

I need to create my own Widget for that? Because now I’m simply using the AddMenuEntry with FText as argument, this one:

void FBaseMenuBuilder::AddMenuEntry( const TAttribute<FText>& InLabel, const TAttribute<FText>& InToolTip, const FSlateIcon& InIcon, const FUIAction& InAction, FName InExtensionHook, const EUserInterfaceActionType::Type UserInterfaceActionType, FName InTutorialHighlightName )

In that case I don’t know if it’s possible, through MenuBuilder, since there you cannot provide your own Widget class.

Thank you, I think I will make my own widget for the menu item and put the OnMouseEnter there.

This is the code for OnMouseEnter and OnMouseLeve on a menu item, in case somebody need it in the future.
The menu item widget itself is a simplified version of one found in SMenuEntryBlock::BuildMenuEntryWidget, without icon and checkbox.
You don’t need to implement a custom widget, use handlers provided by SWidget.

FText EntryName = ....... ;

TSharedPtr< SWidget > ButtonContent =

+ SHorizontalBox::Slot()
.Padding(FMargin(2, 0, 6, 0))

    .TextStyle(FEditorStyle::Get(), FEditorStyle::Join(StyleName, ".Label"))

    [EntryName](const FGeometry& G, const FPointerEvent&E) {
        UE_LOG(LogTemp, Log, TEXT("MOUSE ENTER: %s"),*EntryName.ToString());

    [EntryName](const FPointerEvent&E) {
        UE_LOG(LogTemp, Log, TEXT("MOUSE LEAVE: %s"), *EntryName.ToString());

        FExecuteAction::CreateLambda(]() {
            //Menu item clicked, do something

Oh sure… I totally forgot about the ->SetXXX() functions on Slate widgets lol