BlueRoseNote/03-UnrealEngine/Editor/UE消息对话框使用.md
2023-06-29 11:55:02 +08:00

958 B

title, date, excerpt, tags, rating
title date excerpt tags rating
UE消息对话框使用 2022-09-28 14:41:08
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消息对话框
	}
}