From 767f19cf25d5e9dc46ca05ccbc7cf1f850a21241 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 20 Aug 2020 17:11:40 +0200 Subject: [PATCH] Add menu item to clear log in the grid window Just make it more convenient to read the logs in it. --- samples/grid/griddemo.cpp | 13 +++++++++++++ samples/grid/griddemo.h | 1 + 2 files changed, 14 insertions(+) diff --git a/samples/grid/griddemo.cpp b/samples/grid/griddemo.cpp index 9c32964145..e07c699b42 100644 --- a/samples/grid/griddemo.cpp +++ b/samples/grid/griddemo.cpp @@ -326,6 +326,7 @@ wxBEGIN_EVENT_TABLE( GridFrame, wxFrame ) EVT_MENU( ID_SET_CELL_BG_COLOUR, GridFrame::SetCellBgColour ) EVT_MENU( wxID_ABOUT, GridFrame::OnAbout ) + EVT_MENU( wxID_CLEAR, GridFrame::OnClear ) EVT_MENU( wxID_EXIT, GridFrame::OnQuit ) EVT_MENU( ID_VTABLE, GridFrame::OnVTable) EVT_MENU( ID_BUGS_TABLE, GridFrame::OnBugsTable) @@ -420,6 +421,11 @@ GridFrame::GridFrame() fileMenu->Append( wxID_PRINT, "Render" ); fileMenu->Append( ID_RENDER_COORDS, "Render G5:P30" ); +#if wxUSE_LOG + fileMenu->AppendSeparator(); + fileMenu->Append( wxID_CLEAR, "Clear &log\tCtrl-L" ); +#endif // wxUSE_LOG + fileMenu->AppendSeparator(); fileMenu->Append( wxID_EXIT, "E&xit\tAlt-X" ); @@ -1767,6 +1773,13 @@ void GridFrame::OnAbout( wxCommandEvent& WXUNUSED(ev) ) } +void GridFrame::OnClear( wxCommandEvent& WXUNUSED(ev) ) +{ +#if wxUSE_LOG + logWin->Clear(); +#endif // wxUSE_LOG +} + void GridFrame::OnQuit( wxCommandEvent& WXUNUSED(ev) ) { Close( true ); diff --git a/samples/grid/griddemo.h b/samples/grid/griddemo.h index f02a32d821..fa196b0643 100644 --- a/samples/grid/griddemo.h +++ b/samples/grid/griddemo.h @@ -130,6 +130,7 @@ public: ~GridFrame(); void OnQuit( wxCommandEvent& ); + void OnClear( wxCommandEvent& ); void OnAbout( wxCommandEvent& ); void OnVTable( wxCommandEvent& ); void OnBugsTable( wxCommandEvent& );