Redigging this, because I found a way to do this WITHOUT CommonUI, by going the “hard” way.
I needed my Custom Player Pawn Controller with Input Action Pointers and Functions to navigate the Menu.
Firstly fetching the input action and mapping context assets filepaths and assigning them to these functions.
class MYGAME_API ACndPlayer_Master : public APawn
UPROPERTY()
UCndWgt_MenuPage_Master* CndMenu = nullptr;
void ACndPlayer_Master::BP_IA_MenuSelectUp()
{
if (CndMenu)
{
CndMenu->BPF_Update_SelectListItem(CndWgt_HA_ListItemUp);
}
}
void ACndPlayer_Master::BP_IA_MenuSelectDown()
{
if (CndMenu)
{
CndMenu->BPF_Update_SelectListItem(CndWgt_HA_ListItemDown);
}
}
Then make Master Page Widget, that stores menu buttons (List Items), navigational data (such as current list item, page, tab) and derives (such as Options Page). Along with ability to cast tasks to the derives.
First what Options Page Derive (for ex.) does, when created, it tries to find the owner of the widget, with the following function.
UFUNCTION(BlueprintCallable, Category = "CndWgt_Menu")
void BPF_InitWidget(ACndPlayer_Master* InOwner);
void UCndWgt_MenuPage_Master::BPF_InitWidget(ACndPlayer_Master* InOwner)
{
WidgetOwner = InOwner;
}
If found, I can navigate any Widget Menu, that derives from Master.
ListItem_Options that derive from ListItem_Master, are collected from the UMG and stored into MasterListItem array, inside Page Master, then filtered based on desired parameters (such as which tab/page they are assigned to - Gameplay, Accessibility, HUD, Graphics, Audio, Controls).
Of course to know which element is active, I had to make highlight animation that plays forward and reverse, and Custom Event for the derived ListItem Widget.
And to do these hover based events and others for other widget parts:
void UCndWgt_MenuParts_ListItem_Master::NativeConstruct()
{
Super::NativeConstruct();
if (Button_ListItem)
{
Button_ListItem->OnHovered.AddDynamic(this, &UCndWgt_MenuParts_ListItem_Master::BPF_Handle_ListItem_Hovered);
Button_ListItem->OnUnhovered.AddDynamic(this, &UCndWgt_MenuParts_ListItem_Master::BPF_Handle_ListItem_Unhovered);
}
}
void UCndWgt_MenuParts_ListItem_Master::BPF_Handle_ListItem_Hovered()
{
BPF_Handle_ListItem_Highlighted(true);
}
void UCndWgt_MenuParts_ListItem_Master::BPF_Handle_ListItem_Unhovered()
{
BPF_Handle_ListItem_Highlighted(false);
}
UFUNCTION(BlueprintNativeEvent, Category = "CndWgt_Menu", DisplayName = "On ListItem Highlighted")
void BPF_Handle_ListItem_Highlighted(bool Highlight);
virtual void BPF_Handle_ListItem_Highlighted_Implementation(bool Highlight);
void UCndWgt_MenuParts_ListItem_Master::BPF_Handle_ListItem_Highlighted_Implementation(bool Highlight)
{
BPF_Highlight_Switcher(Highlight);
ED_OnListItem_Highlighted.Broadcast(Highlight);
}
That’s all I can tell… but it finally works. And all WITHOUT CommonUI.