0ad/binaries/data/mods/mod/gui/common/functions_msgbox.js
phosit d655455304 Make messageBox return a promise
Ofthen the `messageBox` is only used for confirmation like: "Do you
really want to overwrite the savegame?"
With this patch the code paths of "overwrite savegame" and "make new
savegame" can be combined.

In some cases there is nothing done when one button is pressed. That is
changed to an early return.

Comments by: @Stan
Differential Revision: https://code.wildfiregames.com/D5274
This was SVN commit r28191.
2024-08-11 13:41:32 +00:00

40 lines
810 B
JavaScript

function messageBox(width, height, message, title, buttonCaptions)
{
return Engine.PushGuiPage(
"page_msgbox.xml",
{
"width": width,
"height": height,
"message": message,
"title": title,
"buttonCaptions": buttonCaptions
});
}
function timedConfirmation(width, height, message, timeParameter, timeout, title, buttonCaptions)
{
return Engine.PushGuiPage(
"page_timedconfirmation.xml",
{
"width": width,
"height": height,
"message": message,
"timeParameter": timeParameter,
"timeout": timeout,
"title": title,
"buttonCaptions": buttonCaptions
});
}
function openURL(url)
{
Engine.OpenURL(url);
messageBox(
600, 200,
sprintf(
translate("Opening %(url)s\n in default web browser. Please wait…"),
{ "url": url }
),
translate("Opening page"));
}