mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
fixes up bug: Narrator is not reading the already entered equation when focus lands on Enter a equation edit box.
This commit is contained in:
parent
0048dcb500
commit
284e55a593
2 changed files with 13 additions and 0 deletions
|
@ -72,6 +72,7 @@ MathRichEditBox::MathRichEditBox()
|
|||
{
|
||||
throw Exception::CreateException(hr);
|
||||
}
|
||||
this->GotFocus += ref new RoutedEventHandler(this, &MathRichEditBox::OnGotFocus);
|
||||
this->LosingFocus += ref new TypedEventHandler<UIElement ^,LosingFocusEventArgs ^>(this, &MathRichEditBox::OnLosingFocus);
|
||||
this->KeyUp += ref new KeyEventHandler(this, &MathRichEditBox::OnKeyUp);
|
||||
}
|
||||
|
@ -112,6 +113,16 @@ void MathRichEditBox::SetMathTextProperty(String ^ newValue)
|
|||
this->IsReadOnly = readOnlyState;
|
||||
}
|
||||
|
||||
void MathRichEditBox::OnGotFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e)
|
||||
{
|
||||
// bug: https://dev.azure.com/microsoft/OS/_workitems/edit/28498627
|
||||
// below directives on Selection are going to engage Narrator to announce the content of this richedit
|
||||
// this is a workaround since richedit doesn't announce its content automatically.
|
||||
this->Document->Selection->EndKey(TextRangeUnit::Line, false);
|
||||
this->Document->Selection->HomeKey(TextRangeUnit::Line, false);
|
||||
this->Document->Selection->MoveLeft(TextRangeUnit::Character, 1, false);
|
||||
}
|
||||
|
||||
void MathRichEditBox::OnLosingFocus(UIElement ^ sender, LosingFocusEventArgs ^ args)
|
||||
{
|
||||
if (this->IsReadOnly || this->ContextFlyout->IsOpen)
|
||||
|
@ -122,6 +133,7 @@ void MathRichEditBox::OnLosingFocus(UIElement ^ sender, LosingFocusEventArgs ^ a
|
|||
SubmitEquation(EquationSubmissionSource::FOCUS_LOST);
|
||||
}
|
||||
|
||||
|
||||
void MathRichEditBox::OnKeyUp(Object ^ sender, KeyRoutedEventArgs ^ e)
|
||||
{
|
||||
if (!this->IsReadOnly && e->Key == VirtualKey::Enter)
|
||||
|
|
|
@ -68,6 +68,7 @@ namespace CalculatorApp
|
|||
void SetMathTextProperty(Platform::String ^ newValue);
|
||||
|
||||
void OnLosingFocus(Windows::UI::Xaml::UIElement ^ sender, Windows::UI::Xaml::Input::LosingFocusEventArgs ^ args);
|
||||
void OnGotFocus(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e);
|
||||
void OnKeyUp(Platform::Object ^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs ^ e);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue