summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-31 18:12:10 +0000
committerrubidium <rubidium@openttd.org>2009-12-31 18:12:10 +0000
commitebfdcf575d6dd73f4a7f796f6d381d09eeb411d2 (patch)
tree443d3d974933579e5d0b013879dc1e150312669c
parentde3cff9e1a4ad7982c6de512fd043dd6d3acf52c (diff)
downloadopenttd-ebfdcf575d6dd73f4a7f796f6d381d09eeb411d2.tar.xz
(svn r18676) -Change [FS#3411]: 'escape' in the 'found town' window removes the focus from the town name input box
-rw-r--r--src/town_gui.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 93c0a3a15..bd19ec39e 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -1008,6 +1008,7 @@ public:
InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, MAX_LENGTH_TOWN_NAME_PIXELS);
this->RandomTownName();
this->UpdateButtons(true);
+ this->SetFocusedWidget(TSEW_TOWNNAME_EDITBOX);
}
void RandomTownName()
@@ -1022,7 +1023,6 @@ public:
UpdateTextBufferSize(&this->text);
UpdateOSKOriginalText(this, TSEW_TOWNNAME_EDITBOX);
- this->SetFocusedWidget(TSEW_TOWNNAME_EDITBOX);
this->SetWidgetDirty(TSEW_TOWNNAME_EDITBOX);
}
@@ -1087,6 +1087,7 @@ public:
case TSEW_TOWNNAME_RANDOM:
this->RandomTownName();
+ this->SetFocusedWidget(TSEW_TOWNNAME_EDITBOX);
break;
case TSEW_MANYRANDOMTOWNS:
@@ -1135,7 +1136,9 @@ public:
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state;
- this->HandleEditBoxKey(TSEW_TOWNNAME_EDITBOX, key, keycode, state);
+ if (this->HandleEditBoxKey(TSEW_TOWNNAME_EDITBOX, key, keycode, state) == HEBR_CANCEL) {
+ this->UnfocusFocusedWidget();
+ }
return state;
}