Mercurial > hg > openttd
changeset 13250:f4b2dee1e4c6 draft
(svn r17759) -Codechange [FS#3257]: Return focus to the parent window using the function designed for it.
author | alberth <alberth@openttd.org> |
---|---|
date | Sun, 11 Oct 2009 08:07:09 +0000 |
parents | f52dcc31398e |
children | 7c4df1153a65 |
files | src/osk_gui.cpp |
diffstat | 1 files changed, 3 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -162,22 +162,11 @@ } 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();