Index: binaries/data/mods/public/gui/common/functions_global_object.js =================================================================== --- binaries/data/mods/public/gui/common/functions_global_object.js +++ binaries/data/mods/public/gui/common/functions_global_object.js @@ -26,7 +26,7 @@ g_MessageBoxCallbackArgs = []; }; -function messageBox(mbWidth, mbHeight, mbMessage, mbTitle, mbButtonCaptions, mbBtnCode, mbCallbackArgs) +function messageBox(mbWidth, mbHeight, mbMessage, mbTitle, mbButtonCaptions, mbBtnCode, mbCallbackArgs, mbCancelConfirmHotkeyBinding = [0, 1]) { if (g_MessageBoxBtnFunctions && g_MessageBoxBtnFunctions.length) { @@ -43,7 +43,9 @@ "message": mbMessage, "title": mbTitle, "buttonCaptions": mbButtonCaptions, - "callback": mbBtnCode && "g_MessageBoxCallbackFunction" + "callback": mbBtnCode && "g_MessageBoxCallbackFunction", + // bind index of callback to cancel and confirm hotkey, default first callback is cancel, second callback is confirm + "cancelConfirmHotkeyBinding": mbCancelConfirmHotkeyBinding }); } Index: binaries/data/mods/public/gui/manual/intro.txt =================================================================== --- binaries/data/mods/public/gui/manual/intro.txt +++ binaries/data/mods/public/gui/manual/intro.txt @@ -49,6 +49,8 @@ Shift + F11: Save current profiler data to "logs/profile.txt" F2: Take screenshot (in .png format, location is displayed in the top left of the GUI after the file has been saved, and can also be seen in the console/logs if you miss it there) Shift + F2: Take huge screenshot (6400px*4800px, in .bmp format, location is displayed in the top left of the GUI after the file has been saved, and can also be seen in the console/logs if you miss it there) +ESC: Cancel and close message dialog +Enter: Confirm and close message dialog [font="sans-bold-14"]In Game [font="sans-14"]Double Left Click \[on unit]: Select all of your units of the same kind on the screen (even if they're different ranks) Index: binaries/data/mods/public/gui/msgbox/msgbox.js =================================================================== --- binaries/data/mods/public/gui/msgbox/msgbox.js +++ binaries/data/mods/public/gui/msgbox/msgbox.js @@ -15,7 +15,19 @@ // Default behaviour let mbCancelHotkey = Engine.GetGUIObjectByName("mbCancelHotkey"); - mbCancelHotkey.onPress = Engine.PopGuiPage; + let mbConfirmHotkey = Engine.GetGUIObjectByName("mbConfirmHotkey"); + let popGui = (i) => + { + if (data.callback) + Engine.PopGuiPageCB(i); + else + Engine.PopGuiPage(); + }; + // default esc always pop dialog + mbCancelHotkey.onPress = popGui; + // no bindings wanted, dont bind confirm key + if (data.cancelConfirmHotkeyBinding) + mbConfirmHotkey.onPress = () => popGui(0); // Calculate size let mbLRDiff = data.width / 2; @@ -29,21 +41,20 @@ captions.forEach((caption, i) => { mbButton[i] = Engine.GetGUIObjectByName("mbButton" + (i+1)); - let action = function () - { - if (data.callback) - Engine.PopGuiPageCB(i); - else - Engine.PopGuiPage(); - }; - mbButton[i].caption = caption; - mbButton[i].onPress = action; + mbButton[i].onPress = () => popGui(i); mbButton[i].hidden = false; - // Convention: Cancel is the first button - if (i == 0) - mbCancelHotkey.onPress = action; + if (data.cancelConfirmHotkeyBinding) + { + if (i == data.cancelConfirmHotkeyBinding[0]) + { + mbCancelHotkey.onPress = () => popGui(i); + mbConfirmHotkey.onPress = () => popGui(i); + } + if (i == data.cancelConfirmHotkeyBinding[1]) + mbConfirmHotkey.onPress = () => popGui(i); + } }); // Distribute buttons horizontally Index: binaries/data/mods/public/gui/msgbox/msgbox.xml =================================================================== --- binaries/data/mods/public/gui/msgbox/msgbox.xml +++ binaries/data/mods/public/gui/msgbox/msgbox.xml @@ -7,6 +7,7 @@ +