Explorar o código

Merge pull request #2214 from BDisp/contextmenu.isshow-fix-2213

Fixes #2213. ContextMenu.IsShow is wrongly inheriting previous value on a new instance.
Tig %!s(int64=2) %!d(string=hai) anos
pai
achega
a4f637b045
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      Terminal.Gui/Views/ContextMenu.cs

+ 5 - 2
Terminal.Gui/Views/ContextMenu.cs

@@ -52,7 +52,10 @@ namespace Terminal.Gui {
 		public ContextMenu (int x, int y, MenuBarItem menuItems)
 		{
 			if (IsShow) {
-				Hide ();
+				if (menuBar.SuperView != null) {
+					Hide ();
+				}
+				IsShow = false;
 			}
 			MenuItems = menuItems;
 			Position = new Point (x, y);
@@ -126,7 +129,7 @@ namespace Terminal.Gui {
 			} else if (ForceMinimumPosToZero && position.Y < 0) {
 				position.Y = 0;
 			}
-			
+
 			menuBar = new MenuBar (new [] { MenuItems }) {
 				X = position.X,
 				Y = position.Y,