Show new wxTextCtrl value in the widgets sample

This is useful for quickly checking that we're getting expected events
when modifying the control and/or not getting any unexpected ones and
was already done on wxComboBox page, but not for wxTextCtrl.
This commit is contained in:
Vadim Zeitlin 2019-07-08 11:08:53 +02:00
parent a2ffca0d96
commit 7206194d08

View File

@ -31,6 +31,7 @@
#include "wx/bitmap.h"
#include "wx/button.h"
#include "wx/checkbox.h"
#include "wx/dcclient.h"
#include "wx/radiobox.h"
#include "wx/statbox.h"
#include "wx/stattext.h"
@ -986,7 +987,7 @@ void TextWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
(m_radioWrap->GetSelection() != DEFAULTS.wrapStyle) );
}
void TextWidgetsPage::OnText(wxCommandEvent& WXUNUSED(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
@ -998,7 +999,16 @@ void TextWidgetsPage::OnText(wxCommandEvent& WXUNUSED(event))
return;
}
wxLogMessage("Text ctrl value changed");
// Replace middle of long text with ellipsis just to avoid filling up the
// log control with too much unnecessary stuff.
wxLogMessage("Text control value changed (now '%s')",
wxControl::Ellipsize
(
event.GetString(),
wxClientDC(this),
wxELLIPSIZE_MIDDLE,
GetTextExtent('W').x*100
));
}
void TextWidgetsPage::OnTextEnter(wxCommandEvent& event)