don't use unneeded logBuf member variable; show the changed cell value in OnCellValueChanged()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-10-28 13:46:18 +00:00
parent 6c7f5e56a8
commit 5b313974cd
2 changed files with 16 additions and 27 deletions

View File

@@ -789,7 +789,7 @@ void GridFrame::OnAddToSelectToggle(wxCommandEvent& event)
void GridFrame::OnLabelLeftClick( wxGridEvent& ev ) void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
{ {
logBuf = wxEmptyString; wxString logBuf;
if ( ev.GetRow() != -1 ) if ( ev.GetRow() != -1 )
{ {
logBuf << _T("Left click on row label ") << ev.GetRow(); logBuf << _T("Left click on row label ") << ev.GetRow();
@@ -803,8 +803,10 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
logBuf << _T("Left click on corner label"); logBuf << _T("Left click on corner label");
} }
if ( ev.ShiftDown() ) logBuf << _T(" (shift down)"); if ( ev.ShiftDown() )
if ( ev.ControlDown() ) logBuf << _T(" (control down)"); logBuf << _T(" (shift down)");
if ( ev.ControlDown() )
logBuf << _T(" (control down)");
wxLogMessage( wxT("%s"), logBuf.c_str() ); wxLogMessage( wxT("%s"), logBuf.c_str() );
// you must call event skip if you want default grid processing // you must call event skip if you want default grid processing
@@ -815,10 +817,7 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev )
void GridFrame::OnCellLeftClick( wxGridEvent& ev ) void GridFrame::OnCellLeftClick( wxGridEvent& ev )
{ {
logBuf = wxEmptyString; wxLogMessage(_T("Left click at row %d, col %d"), ev.GetRow(), ev.GetCol());
logBuf << _T("Left click at row ") << ev.GetRow()
<< _T(" col ") << ev.GetCol();
wxLogMessage( wxT("%s"), logBuf.c_str() );
// you must call event skip if you want default grid processing // you must call event skip if you want default grid processing
// (cell highlighting etc.) // (cell highlighting etc.)
@@ -829,9 +828,7 @@ void GridFrame::OnCellLeftClick( wxGridEvent& ev )
void GridFrame::OnRowSize( wxGridSizeEvent& ev ) void GridFrame::OnRowSize( wxGridSizeEvent& ev )
{ {
logBuf = wxEmptyString; wxLogMessage(_T("Resized row %d"), ev.GetRowOrCol());
logBuf << _T("Resized row ") << ev.GetRowOrCol();
wxLogMessage( wxT("%s"), logBuf.c_str() );
ev.Skip(); ev.Skip();
} }
@@ -839,9 +836,7 @@ void GridFrame::OnRowSize( wxGridSizeEvent& ev )
void GridFrame::OnColSize( wxGridSizeEvent& ev ) void GridFrame::OnColSize( wxGridSizeEvent& ev )
{ {
logBuf = wxEmptyString; wxLogMessage(_T("Resized col %d"), ev.GetRowOrCol());
logBuf << _T("Resized col ") << ev.GetRowOrCol();
wxLogMessage( wxT("%s"), logBuf.c_str() );
ev.Skip(); ev.Skip();
} }
@@ -925,7 +920,7 @@ void GridFrame::OnShowSelection(wxCommandEvent& WXUNUSED(event))
void GridFrame::OnSelectCell( wxGridEvent& ev ) void GridFrame::OnSelectCell( wxGridEvent& ev )
{ {
logBuf = wxEmptyString; wxString logBuf;
if ( ev.Selecting() ) if ( ev.Selecting() )
logBuf << _T("Selected "); logBuf << _T("Selected ");
else else
@@ -950,7 +945,7 @@ void GridFrame::OnSelectCell( wxGridEvent& ev )
void GridFrame::OnRangeSelected( wxGridRangeSelectEvent& ev ) void GridFrame::OnRangeSelected( wxGridRangeSelectEvent& ev )
{ {
logBuf = wxEmptyString; wxString logBuf;
if ( ev.Selecting() ) if ( ev.Selecting() )
logBuf << _T("Selected "); logBuf << _T("Selected ");
else else
@@ -970,24 +965,19 @@ void GridFrame::OnRangeSelected( wxGridRangeSelectEvent& ev )
void GridFrame::OnCellValueChanged( wxGridEvent& ev ) void GridFrame::OnCellValueChanged( wxGridEvent& ev )
{ {
logBuf = wxEmptyString; int row = ev.GetRow(),
logBuf << _T("Value changed for cell at") col = ev.GetCol();
<< _T(" row ") << ev.GetRow()
<< _T(" col ") << ev.GetCol();
wxLogMessage( wxT("%s"), logBuf.c_str() ); wxLogMessage(_T("Value changed for cell at row %d, col %d: now \"%s\""),
row, col, grid->GetCellValue(row, col));
ev.Skip(); ev.Skip();
} }
void GridFrame::OnCellBeginDrag( wxGridEvent& ev ) void GridFrame::OnCellBeginDrag( wxGridEvent& ev )
{ {
logBuf = wxEmptyString; wxLogMessage(_T("Got request to drag cell at row %d, col %d"),
logBuf << _T("Got request to drag cell at") ev.GetRow(), ev.GetCol());
<< _T(" row ") << ev.GetRow()
<< _T(" col ") << ev.GetCol();
wxLogMessage( wxT("%s"), logBuf.c_str() );
ev.Skip(); ev.Skip();
} }

View File

@@ -28,7 +28,6 @@ class GridFrame : public wxFrame
wxTextCtrl *logWin; wxTextCtrl *logWin;
wxLogTextCtrl *logger; wxLogTextCtrl *logger;
#endif // wxUSE_LOG #endif // wxUSE_LOG
wxString logBuf;
void SetDefaults(); void SetDefaults();