add cancel button to 'ask about?'
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||||||
<!-- NOTE: This file should be updated to use relative positioning the next time it changes. -->
|
<!-- NOTE: This file should be updated to use relative positioning the next time it changes. -->
|
||||||
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
|
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
|
||||||
<dialog defbtn='okay'>
|
<dialog defbtn='okay' escbtn='cancel'>
|
||||||
<field name='response' type='text' top='34' left='88' width='75' height='16'/>
|
<field name='response' type='text' top='34' left='88' width='75' height='16'/>
|
||||||
<text name='prompt' size='large' top='6' left='55' width='141' height='16'>You respond:</text>
|
<text name='prompt' size='large' top='6' left='55' width='141' height='16'>You respond:</text>
|
||||||
<pict name='pic' type='dlog' num='16' top='8' left='8'/>
|
<pict name='pic' type='dlog' num='16' top='8' left='8'/>
|
||||||
|
<button name='cancel' type='regular' top='62' left='75'>Cancel</button>
|
||||||
<button name='okay' type='regular' top='62' left='146'>OK</button>
|
<button name='okay' type='regular' top='62' left='146'>OK</button>
|
||||||
</dialog>
|
</dialog>
|
||||||
|
|||||||
@@ -830,9 +830,10 @@ void place_treasure(location where,short level,short loot,short mode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool get_text_response_event_filter(cDialog& me, std::string, eKeyMod) {
|
static bool get_text_response_event_filter(cDialog& me, std::string item_hit, eKeyMod) {
|
||||||
me.toast(true);
|
me.toast(true);
|
||||||
me.setResult(me["response"].getText());
|
if(item_hit == "cancel") me.setResult(std::string {""});
|
||||||
|
else me.setResult(me["response"].getText());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -840,7 +841,7 @@ std::string get_text_response(std::string prompt, pic_num_t pic) {
|
|||||||
set_cursor(sword_curs);
|
set_cursor(sword_curs);
|
||||||
|
|
||||||
cDialog strPanel(*ResMgr::dialogs.get("get-response"));
|
cDialog strPanel(*ResMgr::dialogs.get("get-response"));
|
||||||
strPanel.attachClickHandlers(get_text_response_event_filter, {"okay"});
|
strPanel.attachClickHandlers(get_text_response_event_filter, {"okay", "cancel"});
|
||||||
if(!prompt.empty()) {
|
if(!prompt.empty()) {
|
||||||
dynamic_cast<cPict&>(strPanel["pic"]).setPict(pic);
|
dynamic_cast<cPict&>(strPanel["pic"]).setPict(pic);
|
||||||
strPanel["prompt"].setText(prompt);
|
strPanel["prompt"].setText(prompt);
|
||||||
|
|||||||
Reference in New Issue
Block a user