diff options
author | alberth <alberth@openttd.org> | 2009-05-30 14:18:06 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-05-30 14:18:06 +0000 |
commit | e03376c2392fe454689f181a4c02907a7a1a284f (patch) | |
tree | 2939efd971168182df0724eb1e31e907d6acfe88 /src/osk_gui.cpp | |
parent | 101a6b332064fca3fd8692360375020fcfd69324 (diff) | |
download | openttd-e03376c2392fe454689f181a4c02907a7a1a284f.tar.xz |
(svn r16468) -Codechange: Use GetWidgetOfType() for finding an edit box.
Diffstat (limited to 'src/osk_gui.cpp')
-rw-r--r-- | src/osk_gui.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index d22a14ea4..1b2a825d4 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -147,20 +147,16 @@ struct OskWindow : public Window { } switch (widget) { - case OSK_WIDGET_TEXT: + case OSK_WIDGET_TEXT: { /* Find the edit box of the parent window and give focus to that */ - for (uint i = 0; i < this->parent->widget_count; i++) { - Widget &wi = this->parent->widget[i]; - if (wi.type == WWT_EDITBOX) { - this->parent->focused_widget = &wi; - break; - } - } + const Widget *wi = this->parent->GetWidgetOfType(WWT_EDITBOX); + if (wi != NULL) this->parent->focused_widget = wi; /* Give focus to parent window */ SetFocusedWindow(this->parent); break; + } case OSK_WIDGET_BACKSPACE: if (DeleteTextBufferChar(&this->qs->text, WKC_BACKSPACE)) this->InvalidateParent(); |