Browse Source

Tweaked combobox

Tig 1 năm trước cách đây
mục cha
commit
9bf14c70d3
1 tập tin đã thay đổi với 3 bổ sung7 xóa
  1. 3 7
      Terminal.Gui/Views/ComboBox.cs

+ 3 - 7
Terminal.Gui/Views/ComboBox.cs

@@ -7,6 +7,7 @@
 
 using System.Collections.ObjectModel;
 using System.ComponentModel;
+using System.Diagnostics;
 
 namespace Terminal.Gui;
 
@@ -186,12 +187,6 @@ public class ComboBox : View
             if (SuperView is { } && SuperView.Subviews.Contains (this))
             {
                 Text = string.Empty;
-//                SelectedItem = -1;
-//                _search.Text = string.Empty;
-//                ResetSearchSet ();
-
-//                HideList ();
-////                ShowHideList (string.Empty);
                 SetNeedsDisplay ();
             }
         }
@@ -768,14 +763,15 @@ public class ComboBox : View
     // Sets the search text field Text as well as our own Text property
     private void SetSearchText (string value)
     {
-//        _text = value;
         _search.Text = value;
         _text = value;
     }
 
     private void SetValue (object text, bool isFromSelectedItem = false)
     {
+        // TOOD: THe fact we have to suspend events to change the text makes this feel very hacky.
         _search.TextChanged -= Search_Changed;
+        // Note we set _text, to avoid set_Text from setting _search.Text again
         _text = _search.Text = text.ToString ();
         _search.CursorPosition = 0;
         _search.TextChanged += Search_Changed;