From 2c5bfcc5bf3869c0a33343e9156ef6eee75ae3ba Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Wed, 18 Mar 2020 12:57:23 -0400 Subject: [PATCH] fix CustomOptionNumber handling now that we have a NumericTextBox in UWT --- .../Dialogs/CustomOptionsDialog.cs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/CSharp/Libraries/UniversalEditor.UserInterface/Dialogs/CustomOptionsDialog.cs b/CSharp/Libraries/UniversalEditor.UserInterface/Dialogs/CustomOptionsDialog.cs index 9fea1189..54d602a2 100644 --- a/CSharp/Libraries/UniversalEditor.UserInterface/Dialogs/CustomOptionsDialog.cs +++ b/CSharp/Libraries/UniversalEditor.UserInterface/Dialogs/CustomOptionsDialog.cs @@ -105,24 +105,25 @@ namespace UniversalEditor.UserInterface.Dialogs { CustomOptionNumber option = (eo as CustomOptionNumber); - TextBox txt = new TextBox(); // NumericUpDown txt = new NumericUpDown(); + // NumericUpDown in WinForms used decimal, UWT uses double... what's the difference? is it bad? + NumericTextBox txt = new NumericTextBox(); // NumericUpDown txt = new NumericUpDown(); if (option.MaximumValue.HasValue) { - // txt.Maximum = option.MaximumValue.Value; + txt.Maximum = (double)option.MaximumValue.Value; } else { - // txt.Maximum = Decimal.MaxValue; + txt.Maximum = Double.MaxValue; } if (option.MinimumValue.HasValue) { - // txt.Minimum = option.MinimumValue.Value; + txt.Minimum = (double)option.MinimumValue.Value; } else { - // txt.Minimum = Decimal.MinValue; + txt.Minimum = Double.MinValue; } - // txt.Value = option.DefaultValue; + txt.Value = (double)option.DefaultValue; this.Controls.Add(txt, new GridLayout.Constraints(iRow, 1, 1, 2, ExpandMode.Horizontal)); @@ -266,13 +267,12 @@ namespace UniversalEditor.UserInterface.Dialogs if (!eo.Visible) continue; Control ctl = CustomOptionControls[eo.PropertyName]; - /* - if (ctl is NumericUpDown) + + if (ctl is NumericTextBox) { - NumericUpDown itm = (ctl as NumericUpDown); - (eo as CustomOptionNumber).Value = itm.Value; + NumericTextBox itm = (ctl as NumericTextBox); + (eo as CustomOptionNumber).Value = (decimal)itm.Value; } - */ if (ctl is CheckBox) { CheckBox itm = (ctl as CheckBox);