//-/////////////////////////////////////////////////////////////////////// //-/////////////////////////////////////////////////////////////////////// public void HandleAttrValueSet(object sender, EventArgs e) { object newValue = ((Attr)sender).GetValue(); if (newValue is string) { _textBox.Text = (string)newValue; Misc.SetCleanColour(_textBox); } }
//-/////////////////////////////////////////////////////////////////////// //-/////////////////////////////////////////////////////////////////////// private void HandleAttrValueSet(object sender, EventArgs e) { object newValue = ((Attr)sender).GetValue(); if (newValue is float || newValue is double) { _isFloat = newValue is float; _textBox.Text = newValue.ToString(); Misc.SetCleanColour(_textBox); } }
//-/////////////////////////////////////////////////////////////////////// //-/////////////////////////////////////////////////////////////////////// private void HandleAttrValueSet(object sender, EventArgs e) { object newValue = ((Attr)sender).GetValue(); if (newValue is V2) { V2 v2 = (V2)newValue; _xTextBox.Text = v2.x.ToString(); _yTextBox.Text = v2.y.ToString(); Misc.SetCleanColour(_xTextBox, _yTextBox); } }
//-/////////////////////////////////////////////////////////////////////// //-/////////////////////////////////////////////////////////////////////// private void HandleScriptValueDirty(object sender, System.EventArgs e) { double value; if (double.TryParse(_textBox.Text, out value)) { Attr.SilentSetValue(_isFloat ? (float)value : value); Misc.SetCleanColour(_textBox); } else { Misc.SetBadColour(_textBox); } }
//-/////////////////////////////////////////////////////////////////////// //-/////////////////////////////////////////////////////////////////////// private void HandleScriptValueDirty(object sender, System.EventArgs e) { double x, y; bool goodX = double.TryParse(_xTextBox.Text, out x); bool goodY = double.TryParse(_yTextBox.Text, out y); if (goodX && goodY) { Attr.SilentSetValue(new V2(x, y)); Misc.SetCleanColour(_xTextBox, _yTextBox); } else { Misc.SetBadColour(goodX ? null : _xTextBox, goodY ? null : _yTextBox); } }
//-/////////////////////////////////////////////////////////////////////// //-/////////////////////////////////////////////////////////////////////// private void HandleScriptValueDirty(object sender, System.EventArgs e) { Attr.SilentSetValue(_textBox.Text); Misc.SetCleanColour(_textBox); }