Don't show message box in text sample unnecessarily

This is going to be just annoying on the platforms where spell checking
is not supported, so show the message inside the text control itself
rather than popping up a message box.

Also put a misspelled word in the control from the very beginning to
show that it is highlighted.
This commit is contained in:
Vadim Zeitlin
2021-08-23 00:58:00 +02:00
parent 2bb3083a93
commit 79fe43c22d

View File

@@ -1209,20 +1209,23 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
m_enter->SetClientData(const_cast<void*>(static_cast<const void*>(wxS("enter"))));
#if wxUSE_SPELLCHECK
(*m_enter) << "\n";
// Enable grammar check just for demonstration purposes (note that it's
// only supported under Mac, but spell checking will be enabled under the
// other platforms too, if supported). If we didn't want to enable it, we
// could omit the EnableProofCheck() argument entirely.
if ( !m_enter->EnableProofCheck(wxTextProofOptions::Default().GrammarCheck()) )
{
wxMessageDialog error(this,
wxT("Spell checking is not available on this platform or control style."),
wxT("Spell checker error"),
wxOK | wxCENTER | wxICON_ERROR);
error.ShowModal();
(*m_enter) << "Spell checking is not available on this platform, sorry.";
}
else
(*m_enter) << wxT("\nSpell checking is enabled, try typing a misspelled word...");
{
// Break the string in several parts to avoid misspellings in the sources.
(*m_enter) << "Spell checking is enabled, mis"
"s"
"spelled words should be highlighted.";
}
#endif
m_textrich = new MyTextCtrl(this, wxID_ANY, "Allows more than 30Kb of text\n"