diff --git a/samples/widgets/textctrl.cpp b/samples/widgets/textctrl.cpp index 8618261215..cda0bc9362 100644 --- a/samples/widgets/textctrl.cpp +++ b/samples/widgets/textctrl.cpp @@ -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)