瀏覽代碼

ComboBox. Use SuperView to determine if control has been added to a container view

Ross Ferguson 5 年之前
父節點
當前提交
4790a52639
共有 1 個文件被更改,包括 2 次插入4 次删除
  1. 2 4
      Terminal.Gui/Views/ComboBox.cs

+ 2 - 4
Terminal.Gui/Views/ComboBox.cs

@@ -29,7 +29,8 @@ namespace Terminal.Gui {
 			set {
 				source = value;
 
-				if(isAdded) { 
+				// Only need to refresh list if its been added to a container view
+				if(SuperView != null && SuperView.Subviews.Contains(this)) { 
 					Search_Changed ("");
 					SetNeedsDisplay ();
 				}
@@ -66,7 +67,6 @@ namespace Terminal.Gui {
 		readonly TextField search;
 		readonly ListView listview;
 		bool autoHide = true;
-		bool isAdded;
 
 		/// <summary>
 		/// Public constructor
@@ -163,8 +163,6 @@ namespace Terminal.Gui {
 				} else {
 					search.ColorScheme = Colors.Menu;
 				}
-
-				isAdded = true;
 			};
 		}