From d83f78d3787b9dc035130ebb6e056b6e2f0ca788 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Wed, 19 Apr 2017 09:59:39 +0200 Subject: [PATCH] check if HoverWidget is removed from graphic tree --- src/GraphicObjects/Group.cs | 7 +++++++ src/GraphicObjects/PrivateContainer.cs | 5 +++++ src/Interface.cs | 8 ++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index d4b5b62e..549ca219 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -75,6 +75,13 @@ namespace Crow { child.LayoutChanged -= OnChildLayoutChanges; //child.Parent = null; + + //check if HoverWidget is removed from Tree + if (CurrentInterface.HoverWidget != null) { + if (this.Contains (CurrentInterface.HoverWidget)) + CurrentInterface.HoverWidget = null; + } + lock (children) Children.Remove(child); diff --git a/src/GraphicObjects/PrivateContainer.cs b/src/GraphicObjects/PrivateContainer.cs index 65eacabb..4076b5ec 100644 --- a/src/GraphicObjects/PrivateContainer.cs +++ b/src/GraphicObjects/PrivateContainer.cs @@ -53,6 +53,11 @@ namespace Crow { if (child != null) { + //check if HoverWidget is removed from Tree + if (CurrentInterface.HoverWidget != null) { + if (this.Contains (CurrentInterface.HoverWidget)) + CurrentInterface.HoverWidget = null; + } contentSize = new Size (0, 0); child.LayoutChanged -= OnChildLayoutChanges; child.Parent = null; diff --git a/src/Interface.cs b/src/Interface.cs index 62ac6ce3..9e5175fb 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -82,7 +82,6 @@ namespace Crow public static int DeviceRepeatInterval = 40; /// Tabulation size in Text controls public static int TabSize = 4; - public static bool ReplaceTabsWithSpace = false; public static string LineBreak = "\r\n"; /// Allow rendering of interface in development environment public static bool DesignerMode = false; @@ -146,7 +145,6 @@ namespace Crow /// on the first instance creation of a IML item. /// public static Dictionary Instantiators = new Dictionary(); - public bool DesignMode = false; public List CrowThreads = new List();//used to monitor thread finished #endregion @@ -575,6 +573,10 @@ namespace Crow public void DeleteWidget(GraphicObject g) { g.Visible = false;//trick to ensure clip is added to refresh zone + if (_hoverWidget != null) { + if (g.Contains (_hoverWidget)) + HoverWidget = null; + } lock (UpdateMutex) GraphicTree.Remove (g); } @@ -683,7 +685,6 @@ namespace Crow } if (HoverWidget != null) { - //TODO, ensure object is still in the graphic tree //check topmost graphicobject first GraphicObject tmp = HoverWidget; GraphicObject topc = null; @@ -710,7 +711,6 @@ namespace Crow } } - if (HoverWidget.MouseIsIn (e.Position)) { HoverWidget.checkHoverWidget (e); return true; -- 2.47.3