mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
ComboBox supports Dim.Fill() Dim.Percent()
This commit is contained in:
@@ -421,26 +421,27 @@ static class Demo {
|
||||
MessageBox.Query (60, 10, "Selected Animals", result == "" ? "No animals selected" : result, "Ok");
|
||||
}
|
||||
|
||||
//static void ComboBoxDemo ()
|
||||
//{
|
||||
// IList<string> items = new List<string> ();
|
||||
// foreach (var dir in new [] { "/etc", @"\windows\System32" }) {
|
||||
// if (Directory.Exists (dir)) {
|
||||
// items = Directory.GetFiles (dir)
|
||||
// .Select (Path.GetFileName)
|
||||
// .Where (x => char.IsLetterOrDigit (x [0]))
|
||||
// .Distinct ()
|
||||
// .OrderBy (x => x).ToList ();
|
||||
// }
|
||||
// }
|
||||
// var list = new ComboBox (0, 0, 36, 7, items);
|
||||
// list.Changed += (object sender, ustring text) => { Application.RequestStop (); };
|
||||
static void ComboBoxDemo ()
|
||||
{
|
||||
IList<string> items = new List<string> ();
|
||||
foreach (var dir in new [] { "/etc", @"\windows\System32" }) {
|
||||
if (Directory.Exists (dir)) {
|
||||
items = Directory.GetFiles (dir)
|
||||
.Select (Path.GetFileName)
|
||||
.Where (x => char.IsLetterOrDigit (x [0]))
|
||||
.Distinct ()
|
||||
.OrderBy (x => x).ToList ();
|
||||
}
|
||||
}
|
||||
var list = new ComboBox () { X = 0, Y = 0, Width = 36, Height = 7 };
|
||||
list.SetSource(items);
|
||||
list.Changed += (object sender, ustring text) => { Application.RequestStop (); };
|
||||
|
||||
// var d = new Dialog ("Select source file", 40, 12) { list };
|
||||
// Application.Run (d);
|
||||
var d = new Dialog ("Select source file", 40, 12) { list };
|
||||
Application.Run (d);
|
||||
|
||||
// MessageBox.Query (60, 10, "Selected file", list.Text.ToString() == "" ? "Nothing selected" : list.Text.ToString(), "Ok");
|
||||
//}
|
||||
MessageBox.Query (60, 10, "Selected file", list.Text.ToString() == "" ? "Nothing selected" : list.Text.ToString(), "Ok");
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -571,7 +572,7 @@ static class Demo {
|
||||
new MenuBarItem ("_List Demos", new MenuItem [] {
|
||||
new MenuItem ("Select _Multiple Items", "", () => ListSelectionDemo (true)),
|
||||
new MenuItem ("Select _Single Item", "", () => ListSelectionDemo (false)),
|
||||
// new MenuItem ("Search Single Item", "", ComboBoxDemo)
|
||||
new MenuItem ("Search Single Item", "", ComboBoxDemo)
|
||||
}),
|
||||
new MenuBarItem ("A_ssorted", new MenuItem [] {
|
||||
new MenuItem ("_Show text alignments", "", () => ShowTextAlignments ()),
|
||||
|
||||
Reference in New Issue
Block a user