Message Popup Widget
Introduction
The widget used to display a message popup
Dependencies
The MessagePopupWidget relies on other components of this plugin to work:
- Logger: Used to log useful information to help you debug any issues you might experience
Required Widgets
You need to add the following before you can compile the MessagePopupWidget widget:
| Name | Description | Type |
|---|---|---|
| TitleText | The text block used to display the title | UTextBlock* |
| MessageText | The text block used to display the message | UTextBlock* |
| ButtonMenu | The menu used to display the buttons | UMenu* |
Optional Animations
You can add the following widgets to enable extra functionality:
| Name | Description |
|---|---|
| ShowAnimation | The animation used to show the popup |
| HideAnimation | The animation used to hide the popup |
API Reference
Properties
| Property | Description | Type | Default Value |
|---|---|---|---|
| ShowAnimation | The animation used to show the popup | UWidgetAnimation* | nullptr |
| HideAnimation | The animation used to hide the popup | UWidgetAnimation* | nullptr |
| ButtonMenuItemClass | The button menu item class used when creating the buttons | TSubclassOf<UMenuItem> |
Events
| Name | Description | Params |
|---|---|---|
| OnShown | Event used to notify other classes that the popup was shown | |
| OnHidden | Event used to notify other classes that the popup was hidden | |
| OnPositiveButtonSelected | Event used to notify other classes that the positive button was selected | |
| OnNegativeButtonSelected | Event used to notify other classes that the negative button was selected | |
| OnNeutralButtonSelected | Event used to notify other classes that the neutral button was selected |
Functions
| Name | Description | Params | Return |
|---|---|---|---|
| Show | Show the message popup | Data (FMessagePopupData) The data used to display the popup |
|
| Hide | Hide the message popup |
Blueprint Usage
You can use the MessagePopupWidget using Blueprints by adding one of the following nodes:
- Ultimate Starter Kit > UI > Show
- Ultimate Starter Kit > UI > Hide
C++ Usage
Before you can use the plugin, you first need to enable the plugin in your Build.cs file:
PublicDependencyModuleNames.Add("USK");
The MessagePopupWidget can now be used in any of your C++ files:
#include "USK/Widgets/MessagePopupWidget.h"
void ATestActor::Test()
{
// MessagePopupWidget is a pointer to the UMessagePopupWidget
MessagePopupWidget->Show(Data);
MessagePopupWidget->Hide();
}