Skip to content

Commit

Permalink
feature complete
Browse files Browse the repository at this point in the history
  • Loading branch information
tig authored and BDisp committed Jun 5, 2020
1 parent b97588a commit 9c8bb5b
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 82 deletions.
42 changes: 21 additions & 21 deletions Example/demo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -422,26 +422,26 @@ static void ListSelectionDemo (bool multiple)
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 (); };

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");
}
//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 (); };

// 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");
//}
#endregion


Expand Down Expand Up @@ -573,7 +573,7 @@ static void Main ()
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 ()),
Expand Down
5 changes: 4 additions & 1 deletion Terminal.Gui/Core/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ public Rect Bounds {
}
}

Pos x, y;
Pos x = Pos.At (0);
Pos y = Pos.At (0);
/// <summary>
/// Gets or sets the X position for the view (the column). Only used whe <see cref="LayoutStyle"/> is <see cref="LayoutStyle.Computed"/>.
/// </summary>
Expand Down Expand Up @@ -382,6 +383,8 @@ public View ()
{
CanFocus = false;
LayoutStyle = LayoutStyle.Computed;
Height = 0;
Width = 0;
}

/// <summary>
Expand Down
Loading

0 comments on commit 9c8bb5b

Please sign in to comment.