protected void ShowDropdown() { if (_itemsUpdated) { _itemsUpdated = false; _list.RemoveChildrenToPool(); if (_items != null) { int cnt = _items.Length; for (int i = 0; i < cnt; i++) { ((GComponent)_list.AddItemFromPool()).GetChildByName("title").asTextField.text = _items[i]; } _list.ResizeToFit(_visibleItemCount); } } _list.selectedIndex = -1; _dropdownObject.width = this.width; //GRoot.inst.ShowPopup(_dropdownObject, this, true); this.root.TogglePopup(_dropdownObject, this, true); if (_dropdownObject.parent != null) { _dropdownObject.displayObject.AddEventListenerObsolete(EventContext.REMOVED_FROM_STAGE, __popupWinClosedObsolete); _dropdownObject.displayObject.onRemovedFromStage.Add(__popupWinClosed); SetState("down"); } }
public PopupMenu(int width = 100, string resourceURL = null) { if (resourceURL == null) { resourceURL = UIConfig.popupMenu; } _contentPane = UIPackage.CreateObjectFromURL(resourceURL).asCom; _contentPane.AddEventListener(EventContext.ADDED_TO_STAGE, __addedToStage); _contentPane.width = width; _list = _contentPane.GetChildByName("list").asList; _list.RemoveChildrenToPool(); _list.AddRelation(_contentPane, RelationType.Width); _contentPane.AddRelation(_list, RelationType.Height); _list.AddEventListener(ItemEvent.CLICK, __clickItem); }
public void ClearItems() { _list.RemoveChildrenToPool(); }