# HG changeset patch # User rubidium # Date 1262283130 0 # Node ID daeac900ff8671ad009ded2ee3c3a7fa53bb2a8d # Parent f3013e86905d3cc90f359f958bf340c23a681311 (svn r18676) -Change [FS#3411]: 'escape' in the 'found town' window removes the focus from the town name input box diff --git a/src/town_gui.cpp b/src/town_gui.cpp --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -1008,6 +1008,7 @@ 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 @@ UpdateTextBufferSize(&this->text); UpdateOSKOriginalText(this, TSEW_TOWNNAME_EDITBOX); - this->SetFocusedWidget(TSEW_TOWNNAME_EDITBOX); this->SetWidgetDirty(TSEW_TOWNNAME_EDITBOX); } @@ -1087,6 +1087,7 @@ case TSEW_TOWNNAME_RANDOM: this->RandomTownName(); + this->SetFocusedWidget(TSEW_TOWNNAME_EDITBOX); break; case TSEW_MANYRANDOMTOWNS: @@ -1135,7 +1136,9 @@ 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; }