Flood.GUI.Controls.ComboBox.AddItem C# (CSharp) Method

AddItem() public method

Adds a new item.
public AddItem ( String label, String name = "" ) : MenuItem
label String Item label (displayed).
name String Item name.
return MenuItem
        public virtual MenuItem AddItem(String label, String name = "")
        {
            MenuItem item = m_Menu.AddItem(label, String.Empty);
            item.Name = name;
            item.Selected += OnItemSelected;

            if (m_SelectedItem == null)
                OnItemSelected(item);

            return item;
        }

Usage Example

Example #1
0
        public void TestComboBox()
        {
            var control = new ComboBox(canvas);
            control.AddItem("opt1");
            control.AddItem("opt2");
            control.AddItem("opt3");

            GUI.Test(control, "ComboBox1");
        }