Check for valid input in min/max/step fields (#1270)

This commit is contained in:
Pepe Rivera
2020-06-15 14:13:56 -07:00
committed by GitHub
parent 2104059f72
commit 4c8e1cb5f0
2 changed files with 23 additions and 0 deletions

View File

@@ -402,6 +402,7 @@ void EquationInputArea::SubmitTextbox(TextBox ^ sender)
else if (sender->Name == "MinTextBox")
{
val = validateDouble(sender->Text, variableViewModel->Min);
variableViewModel->Min = val;
TraceLogger::GetInstance()->LogVariableSettingsChanged(L"MinTextBox");
}
@@ -414,6 +415,13 @@ void EquationInputArea::SubmitTextbox(TextBox ^ sender)
else if (sender->Name == "StepTextBox")
{
val = validateDouble(sender->Text, variableViewModel->Step);
// Don't allow a value less than or equal to 0 as the step
if (val <= 0)
{
val = variableViewModel->Step;
}
variableViewModel->Step = val;
TraceLogger::GetInstance()->LogVariableSettingsChanged(L"StepTextBox");
}