town details cancel button (#685)

This commit is contained in:
2025-05-18 19:28:22 -05:00
parent fbca9477f0
commit 7602c05f98
2 changed files with 3 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<!-- NOTE: This file should be updated to use relative positioning the next time it changes. -->
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
<dialog defbtn='okay'>
<dialog defbtn='okay' escbtn='cancel'>
<pict type='dlog' num='16' top='8' left='8'/>
<text size='large' top='6' left='50' width='256' height='17'>Town Details</text>
@@ -50,6 +50,6 @@
<field name='comment' top='317' left='162' width='251' height='80'/>
</stack>
<!-- OK button -->
<button name='okay' type='regular' top='410' left='349'>OK</button>
<button name='cancel' type='regular' relative='neg pos-in' rel-anchor='prev' top='0' left='71'>Cancel</button>
</dialog>

View File

@@ -713,6 +713,7 @@ void edit_town_details() {
using namespace std::placeholders;
cDialog town_dlg(*ResMgr::dialogs.get("edit-town-details"));
town_dlg["okay"].attachClickHandler(save_town_details);
town_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &town_dlg, false));
town_dlg["chop"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 10000, "The day the town becomes abandoned", "-1 if it doesn't"));
town_dlg["key"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 10, "The event which prevents the town from becoming abandoned", "-1 or 0 for none"));
town_dlg["difficulty"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, 0, 10, "The town difficulty", "0 - easiest, 10 - hardest"));