Miguel de Icaza před 6 roky
rodič
revize
76d79e8852
1 změnil soubory, kde provedl 9 přidání a 9 odebrání
  1. 9 9
      Terminal.Gui/Views/Menu.cs

+ 9 - 9
Terminal.Gui/Views/Menu.cs

@@ -131,13 +131,6 @@ namespace Terminal.Gui {
 				maxW = Math.Max (l, maxW);
 			}
 
-			current = -1;
-			for (int i = 0; i < items.Length; i++) {
-				if (items [i] != null) {
-					current = i;
-					break;
-				}
-			}
 			return new Rect (x, y, maxW + 2, items.Length + 2);
 		}
 
@@ -145,6 +138,13 @@ namespace Terminal.Gui {
 		{
 			this.barItems = barItems;
 			this.host = host;
+			current = -1;
+			for (int i = 0; i < barItems.Children.Length; i++) {
+				if (barItems.Children[i] != null) {
+					current = i;
+					break;
+				}
+			}
 			ColorScheme = Colors.Menu;
 			CanFocus = true;
 		}
@@ -205,7 +205,7 @@ namespace Terminal.Gui {
 					current--;
 					if (current < 0)
 						current = barItems.Children.Length - 1;
-				} while (barItems.Children [current] == null)
+				} while (barItems.Children [current] == null);
 				SetNeedsDisplay ();
 				break;
 			case Key.CursorDown:
@@ -213,7 +213,7 @@ namespace Terminal.Gui {
 					current++;
 					if (current == barItems.Children.Length)
 						current = 0;
-				} while (barItems.Children [current] == null)
+				} while (barItems.Children [current] == null);
 				SetNeedsDisplay ();
 				break;
 			case Key.CursorLeft: