Beispiel #1
0
        // recursively go thru children, bottom child first, and remove everything
        protected virtual void RemoveControl(GLBaseControl child, bool dispose, bool removechildren)
        {
            if (removechildren)
            {
                foreach (var cc in child.childrenz)     // do children of child first
                {
                    RemoveControl(cc, dispose, removechildren);
                }
            }

            //System.Diagnostics.Debug.WriteLine($"Remove control {child.Name} in {Name}");

            child.OnControlRemove(this, child);
            OnControlRemove(this, child);
            //System.Diagnostics.Debug.WriteLine("Remove {0} {1}", child.GetType().Name, child.Name);
            FindDisplay()?.ControlRemoved(child);   // display may be pointing to it

            if (dispose)
            {
                child.Dispose();
            }

            child.parent = null;

            childrenz.Remove(child);
            childreniz.Remove(child);
            CheckZOrder();
        }