From 2caea01c6f26d305c4be948875113d00c3e94b5c Mon Sep 17 00:00:00 2001 From: Pepe Rivera Date: Wed, 11 Mar 2020 09:41:37 -0700 Subject: [PATCH] Fix analyze button being enabled with error (#1061) --- src/Calculator/Controls/EquationTextBox.cpp | 6 +++--- src/Calculator/Controls/EquationTextBox.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Calculator/Controls/EquationTextBox.cpp b/src/Calculator/Controls/EquationTextBox.cpp index 2285fac..4509ecf 100644 --- a/src/Calculator/Controls/EquationTextBox.cpp +++ b/src/Calculator/Controls/EquationTextBox.cpp @@ -74,7 +74,7 @@ void EquationTextBox::OnApplyTemplate() if (m_richEditContextMenu != nullptr) { - m_richEditContextMenu->Opening += ref new EventHandler(this, &EquationTextBox::OnRichEditMenuOpening); + m_richEditContextMenu->Opened += ref new EventHandler(this, &EquationTextBox::OnRichEditMenuOpened); } if (m_deleteButton != nullptr) @@ -344,11 +344,11 @@ bool EquationTextBox::RichEditHasContent() return !text->IsEmpty(); } -void EquationTextBox::OnRichEditMenuOpening(Object ^ /*sender*/, Object ^ /*args*/) +void EquationTextBox::OnRichEditMenuOpened(Object ^ /*sender*/, Object ^ /*args*/) { if (m_kgfEquationMenuItem != nullptr) { - m_kgfEquationMenuItem->IsEnabled = m_HasFocus && RichEditHasContent(); + m_kgfEquationMenuItem->IsEnabled = m_HasFocus && !HasError && RichEditHasContent(); } if (m_colorChooserMenuItem != nullptr) diff --git a/src/Calculator/Controls/EquationTextBox.h b/src/Calculator/Controls/EquationTextBox.h index 15759ec..8362116 100644 --- a/src/Calculator/Controls/EquationTextBox.h +++ b/src/Calculator/Controls/EquationTextBox.h @@ -58,7 +58,7 @@ namespace CalculatorApp void OnRemoveButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void OnColorChooserButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); void OnFunctionButtonClicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); - void OnRichEditMenuOpening(Platform::Object ^ sender, Platform::Object ^ args); + void OnRichEditMenuOpened(Platform::Object ^ sender, Platform::Object ^ args); void OnColorFlyoutOpened(Platform::Object ^ sender, Platform::Object ^ e); void OnColorFlyoutClosed(Platform::Object ^ sender, Platform::Object ^ e);