FairyGUI.GComboBox.Setup_AfterAdd C# (CSharp) Method

Setup_AfterAdd() public method

public Setup_AfterAdd ( XML cxml ) : void
cxml FairyGUI.Utils.XML
return void
        public override void Setup_AfterAdd(XML cxml)
        {
            base.Setup_AfterAdd(cxml);

            XML xml = cxml.GetNode("ComboBox");
            if (xml == null)
                return;

            string str;
            str = xml.GetAttribute("titleColor");
            if (str != null)
                this.titleColor = ToolSet.ConvertFromHtmlColor(str);
            visibleItemCount = xml.GetAttributeInt("visibleItemCount", visibleItemCount);
            _popupDirection = xml.GetAttribute("direction", _popupDirection);

            XMLList col = xml.Elements("item");
            _items = new string[col.Count];
            _values = new string[col.Count];
            int i = 0;
            foreach (XML ix in col)
            {
                _items[i] = ix.GetAttribute("title");
                _values[i] = ix.GetAttribute("value");
                str = ix.GetAttribute("icon");
                if (str != null)
                {
                    if (_icons == null)
                        _icons = new string[col.Count];
                    _icons[i] = str;
                }
                i++;
            }

            str = xml.GetAttribute("title");
            if (str != null && str.Length > 0)
            {
                this.text = str;
                _selectedIndex = Array.IndexOf(_items, str);
            }
            else if (_items.Length > 0)
            {
                _selectedIndex = 0;
                this.text = _items[0];
            }
            else
                _selectedIndex = -1;

            str = xml.GetAttribute("icon");
            if (str != null && str.Length > 0)
                this.icon = str;
        }

Usage Example

示例#1
0
 static public int Setup_AfterAdd(IntPtr l)
 {
     try {
         FairyGUI.GComboBox self = (FairyGUI.GComboBox)checkSelf(l);
         FairyGUI.Utils.XML a1;
         checkType(l, 2, out a1);
         self.Setup_AfterAdd(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
All Usage Examples Of FairyGUI.GComboBox::Setup_AfterAdd