diff options
| author | Jacob Palecki <[email protected]> | 2020-08-12 18:18:34 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-08-12 18:18:34 -0700 |
| commit | ae18a1a06060ef66d317af521032ac22fcd88eb3 (patch) | |
| tree | a5eb5c07257c83061bf2f6506779120c2f550f34 | |
| parent | Nicer decimals, enter press not needed to enter values (diff) | |
| download | rawaccel-ae18a1a06060ef66d317af521032ac22fcd88eb3.tar.xz rawaccel-ae18a1a06060ef66d317af521032ac22fcd88eb3.zip | |
Fixed some edge cases around not using enter
| -rw-r--r-- | grapher/Field.cs | 14 | ||||
| -rw-r--r-- | grapher/FieldXY.cs | 4 |
2 files changed, 12 insertions, 6 deletions
diff --git a/grapher/Field.cs b/grapher/Field.cs index d34472b..8d75172 100644 --- a/grapher/Field.cs +++ b/grapher/Field.cs @@ -12,7 +12,7 @@ namespace grapher { #region Constants - public const string DefaultFormatString = "#.#########"; + public const string DefaultFormatString = "0.#########"; #endregion Constants @@ -173,7 +173,6 @@ namespace grapher if (State == FieldState.Typing) { TextToData(); - SetToEntered(); } } @@ -185,8 +184,6 @@ namespace grapher e.Handled = true; e.SuppressKeyPress = true; - - SetToEntered(); } else if (e.KeyCode == Keys.Escape) { @@ -207,6 +204,15 @@ namespace grapher } Box.Text = DecimalString(Data); + + if (string.Equals(Box.Text, DefaultText)) + { + SetToDefault(); + } + else + { + SetToEntered(); + } } private string DecimalString(double value) diff --git a/grapher/FieldXY.cs b/grapher/FieldXY.cs index 87bda18..87e0b9c 100644 --- a/grapher/FieldXY.cs +++ b/grapher/FieldXY.cs @@ -9,9 +9,9 @@ namespace grapher { public class FieldXY { - public const int DefaultSeparation = 6; + public const int DefaultSeparation = 4; - public const string ShortenedFormatString = "#.###"; + public const string ShortenedFormatString = "0.###"; public FieldXY(TextBox xBox, TextBox yBox, CheckBox lockCheckBox, Form containingForm, double defaultData) { |