From 81ea002cf9dc531eed8abfdfc0b1aa7c2ae389b2 Mon Sep 17 00:00:00 2001 From: Pepe Rivera Date: Tue, 16 Jun 2020 09:58:20 -0700 Subject: [PATCH] Fix equations not getting focus after being removed (#1271) --- .../Views/GraphingCalculator/EquationInputArea.xaml.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Calculator/Views/GraphingCalculator/EquationInputArea.xaml.cpp b/src/Calculator/Views/GraphingCalculator/EquationInputArea.xaml.cpp index 3d3650c..834850f 100644 --- a/src/Calculator/Views/GraphingCalculator/EquationInputArea.xaml.cpp +++ b/src/Calculator/Views/GraphingCalculator/EquationInputArea.xaml.cpp @@ -236,6 +236,13 @@ void EquationInputArea::EquationTextBox_RemoveButtonClicked(Object ^ sender, Rou } Equations->GetAt(lastIndex)->FunctionLabelIndex = m_lastFunctionLabelIndex; + + // Focus the next equation after the one we just removed. There should always be at least one ghost equation, + // but check to make sure that there is an equation we can focus in the index where we just removed an equation. + if (index < Equations->Size) + { + FocusEquationTextBox(Equations->GetAt(index)); + } } }