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

This commit is contained in:
BDisp
2020-07-13 13:07:48 +01:00
parent 829cd1e3d1
commit d9e0622654

View File

@@ -69,7 +69,7 @@ namespace Terminal.Gui {
readonly TextField search;
readonly ListView listview;
bool autoHide = true;
int dropDownHeight = 4;
int minimumHeight = 2;
/// <summary>
/// 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 {
/// <value>The selected item or -1 none selected.</value>
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;
///<inheritdoc/>
@@ -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);
}
}
}