diff --git a/src/dlangui/widgets/tree.d b/src/dlangui/widgets/tree.d index f0453a19..b373e35c 100644 --- a/src/dlangui/widgets/tree.d +++ b/src/dlangui/widgets/tree.d @@ -139,7 +139,13 @@ class TreeItem { } void clear() { + foreach(c; _children) { + c.parent = null; + if(c is root.selectedItem) + root.selectItem(null); + } _children.clear(); + root.onUpdate(this); } @property TreeItem parent() { return _parent; }