From bd58bdf4763890f9f86ed20dbf15aac30f21b03b Mon Sep 17 00:00:00 2001 From: OmrSi Date: Fri, 16 Oct 2020 17:42:35 +0300 Subject: [PATCH] Allow controls in measurement converter --- src/Forms/MeasurementConverter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Forms/MeasurementConverter.cs b/src/Forms/MeasurementConverter.cs index d7fbb93f7..59526f8b6 100644 --- a/src/Forms/MeasurementConverter.cs +++ b/src/Forms/MeasurementConverter.cs @@ -4793,12 +4793,12 @@ namespace Nikse.SubtitleEdit.Forms private void textBoxInput_KeyPress(object sender, KeyPressEventArgs e) { - if (char.IsDigit(e.KeyChar)) + if (char.IsControl(e.KeyChar) || char.IsDigit(e.KeyChar)) { return; } - if (e.KeyChar == Convert.ToChar(Keys.Back) || e.KeyChar == '.' || e.KeyChar == ',' || e.KeyChar == '-') + if (e.KeyChar == '.' && !((sender as TextBox).Text.IndexOf('.') > -1) || e.KeyChar == ',' || e.KeyChar == '-' && !((sender as TextBox).Text.IndexOf('-') > -1)) { return; }