public void cleanup()
        {
            GuiStackControl classList = findObjectByInternalName("classList", true);

            if (classList.isObject())
            {
                classList.clear();
            }

            // Initialize the filter list.
            GuiStackControl filterList = findObjectByInternalName("filterList", true);

            if (filterList.isObject())
            {
                filterList.clear();
            }

            GuiPopUpMenuCtrl groupList = findObjectByInternalName("groupList", true);

            if (groupList.isObject())
            {
                groupList.clear();
            }

            if (this["classArray"].isObject())
            {
                this["classArray"].delete();
            }
        }
        public virtual void onSelectObjects(bool val, bool reuseExistingSet = false)
        {
            SimGroup root;
            // Get the root group to search in.
            GuiPopUpMenuCtrl groupList = findObjectByInternalName("groupList", true);

            if (groupList.isObject())
            {
                root = getRootGroup();
            }
            else
            {
                root = groupList.getSelected();
            }

            if (!root.isObject())
            {
                return;
            }
            // Fetch the object name pattern.
            string namePatternField = findObjectByInternalName("namePattern", true);

            if (namePatternField.isObject())
            {
                this["namePattern"] = ((GuiTextEditCtrl)namePatternField).getText();
            }
            else
            {
                this["namePattern"] = "";
            }

            // Clear current selection first, if need be.
            if (val)
            {
                string retainSelectionBox = findObjectByInternalName("retainSelection", true);
                if (retainSelectionBox.isObject() && !((GuiCheckBoxCtrl)retainSelectionBox).isStateOn())
                {
                    clearSelection();
                }
            }

            // (De)Select all matching objects in it.
            selectObjectsIn(root, val, true);
        }