summaryrefslogtreecommitdiff
path: root/src/osk_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-06-04 14:07:05 +0000
committeralberth <alberth@openttd.org>2009-06-04 14:07:05 +0000
commitb144a5451cb451d91bacafd80cab04640d1c1af1 (patch)
tree9eb3dc83f5dfd3b398f76ce3784fef22cdd5767b /src/osk_gui.cpp
parent1a4934ef070aee3e506603707850de28c7f872cd (diff)
downloadopenttd-b144a5451cb451d91bacafd80cab04640d1c1af1.tar.xz
(svn r16516) -Codechange: Added click and drag handling for nested widgets.
Diffstat (limited to 'src/osk_gui.cpp')
-rw-r--r--src/osk_gui.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp
index 1b2a825d4..43b434edb 100644
--- a/src/osk_gui.cpp
+++ b/src/osk_gui.cpp
@@ -149,8 +149,14 @@ struct OskWindow : public Window {
switch (widget) {
case OSK_WIDGET_TEXT: {
/* Find the edit box of the parent window and give focus to that */
- const Widget *wi = this->parent->GetWidgetOfType(WWT_EDITBOX);
- if (wi != NULL) this->parent->focused_widget = wi;
+ 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 */
SetFocusedWindow(this->parent);