Changeset 17405 for branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.cs
- Timestamp:
- 01/21/20 17:14:46 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/JsonItemValidValuesControl.cs
r17404 r17405 21 21 } 22 22 } 23 23 24 } 24 25 25 26 private void AddOption(string opt) { 26 comboBoxValues.Items.Add(opt);27 AddComboOption(opt); 27 28 TextBox tb = new TextBox(); 28 29 tb.Text = opt; … … 30 31 tb.Size = new Size(420, 20); 31 32 tb.ReadOnly = true; 32 Button btn = new Button(); 33 btn.Text = "-"; 34 btn.Size = new Size(20, 20); 35 btn.Click += (o, args) => { 36 tableOptions.Controls.Remove(tb); 37 tableOptions.Controls.Remove(btn); 38 comboBoxValues.Items.Remove(tb.Text); 39 IList<string> items = new List<string>(); 40 foreach(var i in comboBoxValues.Items) { 41 items.Add((string)i); 42 } 43 VM.Item.Range = items; 44 tableOptions.Refresh(); 33 34 CheckBox checkBox = new CheckBox(); 35 checkBox.Checked = true; 36 37 checkBox.CheckStateChanged += (o, args) => { 38 if (checkBox.Checked) 39 AddComboOption(opt); 40 else 41 RemoveComboOption(opt); 45 42 }; 43 tableOptions.Controls.Add(checkBox); 46 44 tableOptions.Controls.Add(tb); 47 tableOptions.Controls.Add(btn);48 45 } 49 46 50 private void buttonAdd_Click(object sender, EventArgs e) { 51 string newOption = textBoxAdd.Text; 52 if (string.IsNullOrWhiteSpace(newOption)) return; 53 textBoxAdd.Text = ""; 54 AddOption(newOption); 47 private void AddComboOption(string opt) { 48 comboBoxValues.Items.Add(opt); 49 IList<string> items = new List<string>(); 50 foreach (var i in comboBoxValues.Items) { 51 items.Add((string)i); 52 } 53 VM.Item.Range = items; 54 tableOptions.Refresh(); 55 55 } 56 56 57 private void RemoveComboOption(string opt) { 58 comboBoxValues.Items.Remove(opt); 59 IList<string> items = new List<string>(); 60 foreach (var i in comboBoxValues.Items) { 61 items.Add((string)i); 62 } 63 VM.Item.Range = items; 64 tableOptions.Refresh(); 65 } 66 57 67 private void comboBoxValues_SelectedValueChanged(object sender, EventArgs e) { 58 68 VM.Item.Value = (string)comboBoxValues.SelectedItem;
Note: See TracChangeset
for help on using the changeset viewer.