Example #1
0
 public Value(ValueDefinition definition)
 {
     Definition = definition;
     Content = definition.GetDefault();
 }
        private void setControlsFromValue(ValueDefinition v)
        {
            removeButton.Enabled = true;

            //Set the name
            nameTextBox.CausesValidation = true;
            nameTextBox.Enabled = true;
            nameTextBox.Text = v.Name;

            //Set the type
            typeComboBox.CausesValidation = true;
            typeComboBox.Enabled = true;
            typeComboBox.SelectedIndex = ValueDefinition.VALUE_TYPES.FindIndex(e => e == v.GetType());

            //Remove the old value editor
            if (valueEditor != null)
                Controls.Remove(valueEditor);

            //Add the new one!
            valueEditor = v.GetEditor();
            if (valueEditor != null)
            {
                valueEditor.TabIndex = 2;
                Controls.Add(valueEditor);
            }
        }