From d9e06226543a129a42d1aff5e7a3dd78816bde3e Mon Sep 17 00:00:00 2001 From: BDisp Date: Mon, 13 Jul 2020 13:07:48 +0100 Subject: [PATCH] Setting a minimum height of 2. 1 to TextField and 1 to ListView. --- Terminal.Gui/Views/ComboBox.cs | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/Terminal.Gui/Views/ComboBox.cs b/Terminal.Gui/Views/ComboBox.cs index b909768ee..ee0a8fffb 100644 --- a/Terminal.Gui/Views/ComboBox.cs +++ b/Terminal.Gui/Views/ComboBox.cs @@ -69,7 +69,7 @@ namespace Terminal.Gui { readonly TextField search; readonly ListView listview; bool autoHide = true; - int dropDownHeight = 4; + int minimumHeight = 2; /// /// Public constructor @@ -111,8 +111,8 @@ namespace Terminal.Gui { private void Initialize () { - if (Bounds.Height < dropDownHeight && Height is Dim.DimAbsolute) { - Height = dropDownHeight; + if (Bounds.Height < minimumHeight && Height is Dim.DimAbsolute) { + Height = minimumHeight; } search.TextChanged += Search_Changed; @@ -162,20 +162,6 @@ namespace Terminal.Gui { /// The selected item or -1 none selected. public int SelectedItem { private set; get; } - /// - /// Gets or Sets the list height when is drop down. Ensures at least the SelectedItem is shown. - /// - public int DropDownHeight { - get { return dropDownHeight; } - set { - if (value < 1) { - dropDownHeight = 1; - } else { - dropDownHeight = value; - } - } - } - bool isShow = false; /// @@ -523,7 +509,7 @@ namespace Terminal.Gui { if (Bounds.Height == 0) return 0; - return Math.Min (Math.Max(Bounds.Height - 1, dropDownHeight), searchset?.Count > 0 ? searchset.Count : isShow ? Math.Max (Bounds.Height - 1, dropDownHeight) : 0); + return Math.Min (Math.Max(Bounds.Height - 1, minimumHeight - 1), searchset?.Count > 0 ? searchset.Count : isShow ? Math.Max (Bounds.Height - 1, minimumHeight - 1) : 0); } } }