mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-28 16:58:01 +01:00
Merge pull request #774 from BDisp/unicode-scenario-combobox-fix
Fixes #773. Added a default drop down height to the ComboBox.
This commit is contained in:
@@ -69,6 +69,7 @@ namespace Terminal.Gui {
|
||||
readonly TextField search;
|
||||
readonly ListView listview;
|
||||
bool autoHide = true;
|
||||
int minimumHeight = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Public constructor
|
||||
@@ -110,6 +111,10 @@ namespace Terminal.Gui {
|
||||
|
||||
private void Initialize ()
|
||||
{
|
||||
if (Bounds.Height < minimumHeight && Height is Dim.DimAbsolute) {
|
||||
Height = minimumHeight;
|
||||
}
|
||||
|
||||
search.TextChanged += Search_Changed;
|
||||
|
||||
listview.Y = Pos.Bottom (search);
|
||||
@@ -504,7 +509,7 @@ namespace Terminal.Gui {
|
||||
if (Bounds.Height == 0)
|
||||
return 0;
|
||||
|
||||
return Math.Min (Bounds.Height - 1, searchset?.Count > 0 ? searchset.Count : isShow ? Bounds.Height - 1 : 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,20 +63,18 @@ namespace UICatalog {
|
||||
var checkBox = new CheckBox (gitString) { X = 20, Y = Pos.Y (label), Width = Dim.Percent (50) };
|
||||
Win.Add (checkBox);
|
||||
|
||||
// BUGBUG: Combobox does not deal with unicode properly.
|
||||
#if false
|
||||
label = new Label ("ComboBox:") { X = Pos.X (label), Y = Pos.Bottom (label) + 1 };
|
||||
Win.Add (label);
|
||||
var comboBox = new ComboBox () {
|
||||
X = 20,
|
||||
Y = Pos.Y (label),
|
||||
Width = Dim.Percent (50),
|
||||
Width = Dim.Percent (50)
|
||||
};
|
||||
comboBox.SetSource (new List<string> () { gitString, "Со_хранить" });
|
||||
|
||||
Win.Add (comboBox);
|
||||
comboBox.Text = gitString;
|
||||
#endif
|
||||
|
||||
label = new Label ("HexView:") { X = Pos.X (label), Y = Pos.Bottom (label) + 2 };
|
||||
Win.Add (label);
|
||||
var hexView = new HexView (new System.IO.MemoryStream (Encoding.ASCII.GetBytes (gitString + " Со_хранить"))) {
|
||||
|
||||
Reference in New Issue
Block a user