// -- DISABLE ONCLICK FOR LISTBOX ITEM (ALSO ADJUSTS ITEM STYLE) public override void DisableByIndex(int intIndex) { if (DdlListBox != null) { DdlListBox.DisableByIndex(intIndex); } }
/// <summary> /// Wait for the ListBoxControl object to finish Initializing before performing actions on it. /// Once Initialized, fill the control with some sample data. /// </summary> /// <returns></returns> private IEnumerator StartEnum() { bool blnDone = false; while (!blnDone) { yield return(null); if (MyListBox != null && MyListBox.IsInitialized) { MyListBox.OnChange += OnDemoChange; MyListBox.OnDoubleClick += OnDemoDoubleClick; for (int i = 4; i < 11; i++) { if (i == 4) { MyListBox.AddItem(i, "Item #" + i.ToString(), "", (i * 3 * 100)); // SET THE SUBTEXT FIELD TO AN INTEGER } else if (i == 5) { MyListBox.AddItem(i, "Item #" + i.ToString(), "", "$200.00"); // SET THE SUBTEXT FIELD TO A STRING } else if (i == 6) { MyListBox.AddItem("Bob", "Item #" + i.ToString()); // USE A STRING AS THE VALUE } else if (i == 7) { MyListBox.AddItem(new string[] { "This", "is", "an", "Array" }, "Item #" + i.ToString()); // USE A STRING ARRAY AS THE VALUE } else if (i == 8) { MyListBox.AddItem(i, "Item #" + i.ToString() + " (disabled)"); MyListBox.DisableByIndex(i - 1); // DISABLE THIS LIST ITEM } else if (i == 9) { MyListBox.AddItem(i, "Item #" + i.ToString(), Resources.Load <Sprite>("Images/Status-Green-DOT-UI")); // ADD ITEM WITH ICON SET BY SPRITE OBJECT } else if (i == 10) { MyListBox.AddItem(i, "Item #" + i.ToString(), "Images/Status-Green-DOT-UI"); // ADD ITEM WITH ICON SET BY PATH TO SPRITE OBJECT } else { MyListBox.AddItem(i, "Item #" + i.ToString()); } } blnDone = true; MyListBox.SetToTop(); // SET THE SCROLLBAR TO THE TOP OF THE LIST } if (MyDDL != null && MyDDL.IsInitialized) { MyDDL.DdlListBox.OnChange += OnDemoChange; for (int i = 4; i < 11; i++) { if (i == 4) { MyDDL.AddItem(i, "Item #" + i.ToString(), "", (i * 3 * 100)); // SET THE SUBTEXT FIELD TO AN INTEGER } else if (i == 5) { MyDDL.AddItem(i, "Item #" + i.ToString(), "", "$200.00"); // SET THE SUBTEXT FIELD TO A STRING } else if (i == 6) { MyDDL.AddItem("Bob", "Item #" + i.ToString()); // USE A STRING AS THE VALUE } else if (i == 7) { MyDDL.AddItem(new string[] { "This", "is", "an", "Array" }, "Item #" + i.ToString()); // USE A STRING ARRAY AS THE VALUE } else if (i == 8) { MyDDL.AddItem(i, "Item #" + i.ToString() + " (disabled)"); MyDDL.DisableByIndex(i - 1); // DISABLE THIS LIST ITEM } else if (i == 9) { MyDDL.AddItem(i, "Item #" + i.ToString(), Resources.Load <Sprite>("Images/Status-Green-DOT-UI")); // ADD ITEM WITH ICON SET BY SPRITE OBJECT } else if (i == 10) { MyDDL.AddItem(i, "Item #" + i.ToString(), "Images/Status-Green-DOT-UI"); // ADD ITEM WITH ICON SET BY PATH TO SPRITE OBJECT } else { MyDDL.AddItem(i, "Item #" + i.ToString()); } } yield return(null); yield return(new WaitForSeconds(0.01f)); for (int i = 11; i <= MAX_DDL_ITEMS; i++) { MyDDL.AddItem(i, "Item #" + i.ToString()); } blnDone = true; MyDDL.SetToTop(); // SET THE SCROLLBAR TO THE TOP OF THE LIST } } DisplaySelection(); }