From 79fe43c22daff6c6d742f24aa12035a368dba730 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 23 Aug 2021 00:58:00 +0200 Subject: [PATCH] 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. --- samples/text/text.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/samples/text/text.cpp b/samples/text/text.cpp index 4a9fd1d33a..44a680b125 100644 --- a/samples/text/text.cpp +++ b/samples/text/text.cpp @@ -1209,20 +1209,23 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) m_enter->SetClientData(const_cast(static_cast(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"