mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-31 02:08:03 +01:00
Setting a minimum height of 2. 1 to TextField and 1 to ListView.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user