Changeset 2924 for trunk/sources/HeuristicLab.Parameters.Views/3.3
- Timestamp:
- 03/04/10 04:52:28 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Parameters.Views/3.3
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Parameters.Views/3.3/ConstrainedValueParameterView.Designer.cs
r2917 r2924 85 85 this.valueGroupBox.TabIndex = 6; 86 86 this.valueGroupBox.TabStop = false; 87 this.valueGroupBox.Text = " &Value:";87 this.valueGroupBox.Text = "Value"; 88 88 // 89 89 // viewHost … … 135 135 #endregion 136 136 137 pr ivateSystem.Windows.Forms.GroupBox valueGroupBox;138 pr ivateHeuristicLab.Core.Views.ViewHost viewHost;139 pr ivateSystem.Windows.Forms.ComboBox valueComboBox;137 protected System.Windows.Forms.GroupBox valueGroupBox; 138 protected HeuristicLab.Core.Views.ViewHost viewHost; 139 protected System.Windows.Forms.ComboBox valueComboBox; 140 140 } 141 141 } -
trunk/sources/HeuristicLab.Parameters.Views/3.3/ConstrainedValueParameterView.cs
r2917 r2924 21 21 22 22 using System; 23 using System. Collections.Generic;23 using System.Linq; 24 24 using HeuristicLab.Collections; 25 25 using HeuristicLab.Core; … … 33 33 [View("ConstrainedValueParameter View")] 34 34 [Content(typeof(ConstrainedValueParameter<>), true)] 35 public sealed partial class ConstrainedValueParameterView<T> : ParameterView where T : class, IItem { 36 private List<T> valueComboBoxItems; 37 35 public partial class ConstrainedValueParameterView<T> : ParameterView where T : class, IItem { 38 36 /// <summary> 39 37 /// Gets or sets the variable to represent visually. … … 52 50 InitializeComponent(); 53 51 Caption = "ConstrainedValueParameter"; 54 valueComboBoxItems = new List<T>();55 52 } 56 53 /// <summary> … … 104 101 105 102 private void FillValueComboBox() { 106 valueComboBox Items.Clear();107 valueComboBox Items.Add(null);103 valueComboBox.SelectedIndexChanged -= new EventHandler(valueComboBox_SelectedIndexChanged); 104 valueComboBox.DataSource = null; 108 105 if (Content != null) { 109 foreach (T item in Content.ValidValues) 110 valueComboBoxItems.Add(item); 106 valueComboBox.DataSource = Content.ValidValues.ToList(); 107 valueComboBox.Enabled = valueComboBox.Items.Count > 0; 108 valueComboBox.SelectedItem = Content.Value; 111 109 } 112 valueComboBox.Items.Clear(); 113 foreach (T item in valueComboBoxItems) 114 valueComboBox.Items.Add(item == null ? "-" : item.ToString()); 115 if (Content != null) valueComboBox.SelectedIndex = valueComboBoxItems.IndexOf(Content.Value); 110 valueComboBox.SelectedIndexChanged += new EventHandler(valueComboBox_SelectedIndexChanged); 116 111 } 117 112 … … 121 116 Invoke(new EventHandler(Content_ValueChanged), sender, e); 122 117 else { 123 valueComboBox.SelectedI ndex = valueComboBoxItems.IndexOf(Content.Value);118 valueComboBox.SelectedItem = Content.Value; 124 119 viewHost.Content = Content.Value; 125 120 } … … 128 123 if (InvokeRequired) 129 124 Invoke(new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsAdded), sender, e); 130 else { 131 foreach (T item in e.Items) { 132 valueComboBoxItems.Add(item); 133 valueComboBox.Items.Add(item == null ? "-" : item.ToString()); 134 } 135 } 125 else 126 FillValueComboBox(); 136 127 } 137 128 private void ValidValues_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<T> e) { 138 129 if (InvokeRequired) 139 130 Invoke(new CollectionItemsChangedEventHandler<T>(ValidValues_ItemsRemoved), sender, e); 140 else { 141 foreach (T item in e.Items) { 142 int index = valueComboBoxItems.IndexOf(item); 143 valueComboBoxItems.RemoveAt(index); 144 valueComboBox.Items.RemoveAt(index); 145 } 146 } 131 else 132 FillValueComboBox(); 147 133 } 148 134 private void ValidValues_CollectionReset(object sender, CollectionItemsChangedEventArgs<T> e) { … … 155 141 156 142 private void valueComboBox_SelectedIndexChanged(object sender, EventArgs e) { 157 Content.Value = valueComboBoxItems[valueComboBox.SelectedIndex];143 Content.Value = (T)valueComboBox.SelectedItem; 158 144 } 159 145 } -
trunk/sources/HeuristicLab.Parameters.Views/3.3/HeuristicLab.Parameters.Views-3.3.csproj
r2900 r2924 91 91 <Compile Include="ConstrainedValueParameterView.Designer.cs"> 92 92 <DependentUpon>ConstrainedValueParameterView.cs</DependentUpon> 93 </Compile> 94 <Compile Include="OptionalConstrainedValueParameterView.cs"> 95 <SubType>UserControl</SubType> 96 </Compile> 97 <Compile Include="OptionalConstrainedValueParameterView.Designer.cs"> 98 <DependentUpon>OptionalConstrainedValueParameterView.cs</DependentUpon> 93 99 </Compile> 94 100 <Compile Include="OptionalValueParameterView.cs"> -
trunk/sources/HeuristicLab.Parameters.Views/3.3/OptionalValueParameterView.Designer.cs
r2917 r2924 90 90 this.valueGroupBox.TabIndex = 6; 91 91 this.valueGroupBox.TabStop = false; 92 this.valueGroupBox.Text = " &Value:";92 this.valueGroupBox.Text = "Value"; 93 93 // 94 94 // valuePanel -
trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueLookupParameterView.Designer.cs
r2917 r2924 100 100 this.valueGroupBox.TabIndex = 8; 101 101 this.valueGroupBox.TabStop = false; 102 this.valueGroupBox.Text = " &Value:";102 this.valueGroupBox.Text = "Value"; 103 103 // 104 104 // valuePanel -
trunk/sources/HeuristicLab.Parameters.Views/3.3/ValueParameterView.Designer.cs
r2917 r2924 85 85 this.valueGroupBox.TabIndex = 6; 86 86 this.valueGroupBox.TabStop = false; 87 this.valueGroupBox.Text = " &Value:";87 this.valueGroupBox.Text = "Value"; 88 88 // 89 89 // valuePanel
Note: See TracChangeset
for help on using the changeset viewer.