Revise int and double fields

This commit is contained in:
John Lewin 2017-09-07 08:04:41 -07:00
parent bb3602c3ff
commit 2e343e5af8
5 changed files with 37 additions and 35 deletions

View file

@ -28,18 +28,27 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
namespace MatterHackers.MatterControl.SlicerConfiguration
{
public class DoubleField : NumberField
{
public static int DoubleEditWidth = (int)(60 * GuiWidget.DeviceScale + .5);
private double doubleValue;
public void OnValueChanged(string text)
protected override string ConvertValue(string newValue)
{
double.TryParse(text, out double currentValue);
numberEdit.ActuallNumberEdit.Value = currentValue;
double.TryParse(newValue, out double currentValue);
doubleValue = (int)currentValue;
return doubleValue.ToString();
}
protected override void OnValueChanged(FieldChangedEventArgs fieldChangedEventArgs)
{
numberEdit.ActuallNumberEdit.Value = doubleValue;
base.OnValueChanged(fieldChangedEventArgs);
}
}
}