summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-10-11 08:07:09 +0000
committeralberth <alberth@openttd.org>2009-10-11 08:07:09 +0000
commitf9733ac590e2be09045ece94ff7fc68be61fdacd (patch)
treebe8ec0f96c1b90ff12c0230182f38c194c87f498
parent59195a6f2021051d135afc03965cebcb3d1c82de (diff)
downloadopenttd-f9733ac590e2be09045ece94ff7fc68be61fdacd.tar.xz
(svn r17759) -Codechange [FS#3257]: Return focus to the parent window using the function designed for it.
-rw-r--r--src/osk_gui.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
index cb4386ee6..b87bbf79a 100644
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -162,22 +162,11 @@ struct OskWindow : public Window {
}
switch (widget) {
- case OSK_WIDGET_TEXT: {
- /* Find the edit box of the parent window and give focus to that */
- if (this->parent->widget != NULL) {
- const Widget *wi = this->parent->GetWidgetOfType(WWT_EDITBOX);
- if (wi != NULL) this->parent->focused_widget = wi;
- }
- if (this->parent->nested_root != NULL) {
- const NWidgetCore *nwid = dynamic_cast<const NWidgetCore *>(this->parent->nested_root->GetWidgetOfType(WWT_EDITBOX));
- if (nwid != NULL) this->parent->nested_focus = nwid;
- }
-
- /* Give focus to parent window */
+ case OSK_WIDGET_TEXT:
+ /* Return focus to the parent widget and window. */
+ this->parent->SetFocusedWidget(this->text_btn);
SetFocusedWindow(this->parent);
-
break;
- }
case OSK_WIDGET_BACKSPACE:
if (DeleteTextBufferChar(&this->qs->text, WKC_BACKSPACE)) this->InvalidateParent();