source: ps/trunk/binaries/data/mods/mod/gui/common/functions_msgbox.js@ 25966

Last change on this file since 25966 was 25966, checked in by Silier, 3 years ago

There have been quite a bit of number of questions how to change scale of the gui, because this option is hidden from the user.

Use dropdown with values. Implement confirmation box with countdown to revert scale change because buttons can get unable to click.

Differential revision: D3037
Comments by: @vladislavbelov, @Stan, @wraitii, @pieq, @sera
Tested by: @Langbart

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1function messageBox(mbWidth, mbHeight, mbMessage, mbTitle, mbButtonCaptions, mbBtnCode, mbCallbackArgs)
2{
3 Engine.PushGuiPage(
4 "page_msgbox.xml",
5 {
6 "width": mbWidth,
7 "height": mbHeight,
8 "message": mbMessage,
9 "title": mbTitle,
10 "buttonCaptions": mbButtonCaptions
11 },
12 btnCode => {
13 if (mbBtnCode !== undefined && mbBtnCode[btnCode])
14 mbBtnCode[btnCode](mbCallbackArgs ? mbCallbackArgs[btnCode] : undefined);
15 });
16}
17
18function timedConfirmation(width, height, message, timeout, title, buttonCaptions, btnCode, callbackArgs)
19{
20 Engine.PushGuiPage(
21 "page_timedconfirmation.xml",
22 {
23 "width": width,
24 "height": height,
25 "message": message,
26 "timeout": timeout,
27 "title": title,
28 "buttonCaptions": buttonCaptions
29 },
30 button => {
31 if (btnCode !== undefined && btnCode[button])
32 btnCode[button](callbackArgs ? callbackArgs[button] : undefined);
33 });
34}
35
36function openURL(url)
37{
38 Engine.OpenURL(url);
39
40 messageBox(
41 600, 200,
42 sprintf(
43 translate("Opening %(url)s\n in default web browser. Please wait…"),
44 { "url": url }
45 ),
46 translate("Opening page"));
47}
Note: See TracBrowser for help on using the repository browser.