32 lines
958 B
Markdown
32 lines
958 B
Markdown
---
|
|
title: UE消息对话框使用
|
|
date: 2022-09-28 14:41:08
|
|
excerpt:
|
|
tags:
|
|
rating: ⭐
|
|
---
|
|
|
|
```c++
|
|
void FSimpleEditorsModule::PluginButtonClicked()
|
|
{
|
|
//消息框显示的消息内容
|
|
FText DialogText = FText::Format(
|
|
LOCTEXT("PluginButtonDialogText", "Add code to {0} in {1} to override this button's actions"),
|
|
FText::FromString(TEXT("FSimpleEditorsModule::PluginButtonClicked()")),
|
|
FText::FromString(TEXT("SimpleEditors.cpp"))
|
|
);
|
|
EAppReturnType::Type ReturnType = FMessageDialog::Open(EAppMsgType::OkCancel, DialogText);
|
|
if (ReturnType == EAppReturnType::Type::Ok)
|
|
{
|
|
//消息框OK按钮被点击执行
|
|
UE_LOG(LogTemp,Log,TEXT("Click OK Button."))
|
|
FMessageDialog::ShowLastError(); //弹出默认的系统原生消息对话框
|
|
}
|
|
else
|
|
{
|
|
//消息框Cancel按钮被点击执行
|
|
UE_LOG(LogTemp, Log, TEXT("Click Cancel Button."))
|
|
FMessageDialog::Debugf(DialogText); //弹出默认的OK消息对话框
|
|
}
|
|
}
|
|
``` |