From ca6eef2d89990b73a9bd1aef0617caa8b0d0ae62 Mon Sep 17 00:00:00 2001 From: Ross Ferguson Date: Wed, 22 Jul 2020 07:33:17 +0100 Subject: [PATCH 1/2] ComboBox in dialog. Only switch off autoHide if its the only control in the dialog --- Terminal.Gui/Views/ComboBox.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 696d9e73a..7a796d2c2 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -142,9 +142,9 @@ namespace Terminal.Gui { Added += (View v) => { - // Determine if this view is hosted inside a dialog + // Determine if this view is hosted inside a dialog and is the only control for (View view = this.SuperView; view != null; view = view.SuperView) { - if (view is Dialog) { + if (view is Dialog && view.Subviews.Count == 1 && view.Subviews [0].Subviews.Count == 1) { autoHide = false; break; } From 0ab562a0fd2117d43144b61866155c46711ff481 Mon Sep 17 00:00:00 2001 From: Ross Ferguson Date: Wed, 22 Jul 2020 16:40:26 +0100 Subject: [PATCH 2/2] Make logic more robust --- Terminal.Gui/Views/ComboBox.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index 7a796d2c2..2912999f7 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -144,7 +144,7 @@ namespace Terminal.Gui { // Determine if this view is hosted inside a dialog and is the only control for (View view = this.SuperView; view != null; view = view.SuperView) { - if (view is Dialog && view.Subviews.Count == 1 && view.Subviews [0].Subviews.Count == 1) { + if (view is Dialog && SuperView != null && SuperView.Subviews.Count == 1 && SuperView.Subviews[0] == this) { autoHide = false; break; }