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:
@@ -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.
|
||||
|
Reference in New Issue
Block a user