// This sets up the control for a specific argument public void Setup(ArgumentInfo arginfo) { int oldvalue = 0; // Get the original value if (typehandler != null) { oldvalue = typehandler.GetIntValue(); } // Get the type handler typehandler = General.Types.GetArgumentHandler(arginfo); // Clear combobox combobox.SelectedItem = null; combobox.Items.Clear(); // Check if this supports enumerated options if (typehandler.IsEnumerable && typehandler.GetEnumList() != null) { // Show the combobox button.Visible = false; scrollbuttons.Visible = false; combobox.DropDownStyle = ComboBoxStyle.DropDown; combobox.Items.AddRange(typehandler.GetEnumList().ToArray()); } // Check if browsable else if (typehandler.IsBrowseable) { // Show the button button.Visible = true; button.Image = typehandler.BrowseImage; scrollbuttons.Visible = false; combobox.DropDownStyle = ComboBoxStyle.Simple; } else { // Show textbox with scroll buttons button.Visible = false; scrollbuttons.Visible = true; combobox.DropDownStyle = ComboBoxStyle.Simple; } // Setup layout ArgumentBox_Resize(this, EventArgs.Empty); // Re-apply value SetValue(oldvalue); }
// This sets up the control for a specific argument public void Setup(ArgumentInfo arginfo) { int oldvalue = 0; // Get the original value if (typehandler != null) { oldvalue = typehandler.GetIntValue(); } // Get the type handler typehandler = General.Types.GetArgumentHandler(arginfo); // Clear combobox combobox.SelectedItem = null; combobox.Items.Clear(); // Check if this supports enumerated options if (typehandler.IsEnumerable) { // Show the combobox button.Visible = false; scrollbuttons.Visible = false; combobox.DropDownStyle = ComboBoxStyle.DropDown; combobox.Items.AddRange(typehandler.GetEnumList().ToArray()); combobox.DropDownWidth = Tools.GetDropDownWidth(combobox); //mxd } // Check if browsable else if (typehandler.IsBrowseable) { // Show the button button.Visible = true; button.Image = typehandler.BrowseImage; scrollbuttons.Visible = false; combobox.DropDownStyle = ComboBoxStyle.Simple; } else { // Show textbox with scroll buttons button.Visible = false; scrollbuttons.Visible = true; combobox.DropDownStyle = ComboBoxStyle.Simple; } //mxd if (typehandler.IsEnumerable) { combobox.AutoCompleteMode = AutoCompleteMode.Suggest; combobox.AutoCompleteSource = AutoCompleteSource.ListItems; } else { combobox.AutoCompleteMode = AutoCompleteMode.None; combobox.AutoCompleteSource = AutoCompleteSource.None; } // Setup layout ArgumentBox_Resize(this, EventArgs.Empty); //mxd. If not mixed values, re-apply the old value if (!string.IsNullOrEmpty(combobox.Text)) { SetValue(oldvalue); } }