From ee4e68bd5e4882397bc023040a2977047d22ccb7 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 15 Jun 2013 15:31:04 +0000 Subject: (svn r25413) -Fix-ish: Suppress focussing editboxes which are not visible. --- src/ai/ai_gui.cpp | 2 ++ src/newgrf_gui.cpp | 6 +++++- src/window.cpp | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index 99f806038..d172780a8 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -1061,6 +1061,8 @@ struct AIDebugWindow : public Window { this->querystrings[WID_AID_BREAK_STR_EDIT_BOX] = &this->break_editbox; + SetWidgetsDisabledState(!this->show_break_box, WID_AID_BREAK_STR_ON_OFF_BTN, WID_AID_BREAK_STR_EDIT_BOX, WID_AID_MATCH_CASE_BTN, WIDGET_LIST_END); + /* Restore the break string value from static variable */ this->break_editbox.text.Assign(this->break_string); diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index fc79decfa..18c539c4e 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -646,7 +646,11 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->querystrings[WID_NS_FILTER] = &this->filter_editbox; this->filter_editbox.cancel_button = QueryString::ACTION_CLEAR; - if (editable) this->SetFocusedWidget(WID_NS_FILTER); + if (editable) { + this->SetFocusedWidget(WID_NS_FILTER); + } else { + this->DisableWidget(WID_NS_FILTER); + } this->avails.SetListing(this->last_sorting); this->avails.SetFiltering(this->last_filtering); diff --git a/src/window.cpp b/src/window.cpp index 297143ebe..4953cefda 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -482,6 +482,8 @@ EventState Window::OnHotkey(int hotkey) if (nw == NULL || nw->IsDisabled()) return ES_NOT_HANDLED; if (nw->type == WWT_EDITBOX) { + if (this->IsShaded()) return ES_NOT_HANDLED; + /* Focus editbox */ this->SetFocusedWidget(hotkey); SetFocusedWindow(this); @@ -891,6 +893,7 @@ void Window::SetShaded(bool make_shaded) int desired = make_shaded ? SZSP_HORIZONTAL : 0; if (this->shade_select->shown_plane != desired) { if (make_shaded) { + if (this->nested_focus != NULL) this->UnfocusFocusedWidget(); this->unshaded_size.width = this->width; this->unshaded_size.height = this->height; this->shade_select->SetDisplayedPlane(desired); -- cgit v1.2.3-70-g09d2