# Show Alert

<figure><img src="https://765684267-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeMDT7jI1SOViaDhhfRbe%2Fuploads%2FzOWL6qBOw2XThHHLzdvn%2FAlertDemo.png?alt=media&#x26;token=ed398bc7-63de-4fc5-8116-a8b60e58f942" alt="" width="375"><figcaption><p>The design is only for demonstrating the plugin functionalities.</p></figcaption></figure>

Alert is just like notification just that it has an option to have up to 2 buttons and wait for the user to click one of the buttons.

For that case, I made an async call that will return when one of the buttons clicked, or when the duration of the alert is timed out.

Just like in the previous page, there's a function called `ShowAlert` that takes a widget of type `AlertWidget`.

{% hint style="info" %}
AlertWidget is a child of NotificationWidget.
{% endhint %}

## Setup Buttons

To setup delegates for the buttons so they could work with this async node, we need to call does 2 functions.

Simply create a button, bind the on-click delegate, and call the matching action that you need.

<figure><img src="https://765684267-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeMDT7jI1SOViaDhhfRbe%2Fuploads%2FY9FLBYTGcMikz0YcqBnq%2FAlert_ButtonsActions.png?alt=media&#x26;token=fee91b75-7e83-4dad-a859-59cd06623e75" alt=""><figcaption></figcaption></figure>

Once you call the functions you need from the user widget, you are ready to go.

{% hint style="info" %}
OnRemovedFromParent will be called either on a button click or when the widget is removed from the parent.
{% endhint %}

## Blueprint

<figure><img src="https://765684267-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FeMDT7jI1SOViaDhhfRbe%2Fuploads%2Fh4Maxbdix7ayN0M30rqs%2FAlertDemo2.png?alt=media&#x26;token=3d14ebd5-ed26-4b00-954f-052c517c78e6" alt=""><figcaption></figcaption></figure>

## C++

```cpp
UAsyncAlertWidget* AlertWidget = UAsyncAlertWidget::ShowAlert(this, /*AlertWidget object goes here*/);
AlertWidget->OnPrimaryButtonClicked.AddDynamic(...);
AlertWidget->OnSecondaryButtonClicked.AddDynamic(...);
AlertWidget->OnRemovedFromParent.AddDynamic(...);
AlertWidget->Activate();
```
