Fix unwanted message boxes in widgets sample once and for all

Add IsUsingLogWindow() that can be used to check if the log messages go
into the listbox instead of being shown in a message box, which was
annoying when starting or quitting the sample.

This is a bit more complicated than the hack previously used in
TextWidgetsPage::OnText(), but more general and can be easily reused for
the focus loss messages, for example.
This commit is contained in:
Vadim Zeitlin
2019-07-08 12:53:02 +02:00
parent 7206194d08
commit 3d9656395a
3 changed files with 50 additions and 10 deletions

View File

@@ -989,15 +989,8 @@ void TextWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
void TextWidgetsPage::OnText(wxCommandEvent& event)
{
// small hack to suppress the very first message: by then the logging is
// not yet redirected and so initial setting of the text value results in
// an annoying message box
static bool s_firstTime = true;
if ( s_firstTime )
{
s_firstTime = false;
if ( !IsUsingLogWindow() )
return;
}
// Replace middle of long text with ellipsis just to avoid filling up the
// log control with too much unnecessary stuff.