Browse Source

Setting a minimum height of 2. 1 to TextField and 1 to ListView.

BDisp 5 years ago
parent
commit
d9e0622654
1 changed files with 4 additions and 18 deletions
  1. 4 18
      Terminal.Gui/Views/ComboBox.cs

+ 4 - 18
Terminal.Gui/Views/ComboBox.cs

@@ -69,7 +69,7 @@ namespace Terminal.Gui {
 		readonly TextField search;
 		readonly TextField search;
 		readonly ListView listview;
 		readonly ListView listview;
 		bool autoHide = true;
 		bool autoHide = true;
-		int dropDownHeight = 4;
+		int minimumHeight = 2;
 
 
 		/// <summary>
 		/// <summary>
 		/// Public constructor
 		/// Public constructor
@@ -111,8 +111,8 @@ namespace Terminal.Gui {
 
 
 		private void Initialize ()
 		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;
 			search.TextChanged += Search_Changed;
@@ -162,20 +162,6 @@ namespace Terminal.Gui {
 		/// <value>The selected item or -1 none selected.</value>
 		/// <value>The selected item or -1 none selected.</value>
 		public int SelectedItem { private set; get; }
 		public int SelectedItem { private set; get; }
 
 
-		/// <summary>
-		/// Gets or Sets the list height when is drop down. Ensures at least the SelectedItem is shown.
-		/// </summary>
-		public int DropDownHeight {
-			get { return dropDownHeight; }
-			set {
-				if (value < 1) {
-					dropDownHeight = 1;
-				} else {
-					dropDownHeight = value;
-				}
-			}
-		}
-
 		bool isShow = false;
 		bool isShow = false;
 
 
 		///<inheritdoc/>
 		///<inheritdoc/>
@@ -523,7 +509,7 @@ namespace Terminal.Gui {
 			if (Bounds.Height == 0)
 			if (Bounds.Height == 0)
 				return 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);
 		}
 		}
 	}
 	}
 }
 }