X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0eee528340ac48e90775cd6694bdaf9c609b6150..1e1d0be19102670c4ea8c08ec5b9fd9467dcf02c:/samples/newgrid/griddemo.cpp diff --git a/samples/newgrid/griddemo.cpp b/samples/newgrid/griddemo.cpp index 10e77f27fb..47e451ef0c 100644 --- a/samples/newgrid/griddemo.cpp +++ b/samples/newgrid/griddemo.cpp @@ -64,12 +64,13 @@ BEGIN_EVENT_TABLE( GridFrame, wxFrame ) EVT_MENU( ID_ABOUT, GridFrame::About ) EVT_MENU( wxID_EXIT, GridFrame::OnQuit ) - EVT_WXGRID_LABEL_LEFT_CLICK( GridFrame::OnLabelLeftClick ) - EVT_WXGRID_CELL_LEFT_CLICK( GridFrame::OnCellLeftClick ) - EVT_WXGRID_ROW_SIZE( GridFrame::OnRowSize ) - EVT_WXGRID_COL_SIZE( GridFrame::OnColSize ) - EVT_WXGRID_RANGE_SELECT( GridFrame::OnRangeSelected ) - EVT_WXGRID_CELL_CHANGE( GridFrame::OnCellValueChanged ) + EVT_GRID_LABEL_LEFT_CLICK( GridFrame::OnLabelLeftClick ) + EVT_GRID_CELL_LEFT_CLICK( GridFrame::OnCellLeftClick ) + EVT_GRID_ROW_SIZE( GridFrame::OnRowSize ) + EVT_GRID_COL_SIZE( GridFrame::OnColSize ) + EVT_GRID_SELECT_CELL( GridFrame::OnSelectCell ) + EVT_GRID_RANGE_SELECT( GridFrame::OnRangeSelected ) + EVT_GRID_CELL_CHANGE( GridFrame::OnCellValueChanged ) END_EVENT_TABLE() @@ -443,20 +444,22 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev ) logBuf = ""; if ( ev.GetRow() != -1 ) { - logBuf << "row label " << ev.GetRow(); + logBuf << "Left click on row label " << ev.GetRow(); } else if ( ev.GetCol() != -1 ) { - logBuf << "col label " << ev.GetCol(); + logBuf << "Left click on col label " << ev.GetCol(); } else { - logBuf << "corner label"; + logBuf << "Left click on corner label"; } if ( ev.ShiftDown() ) logBuf << " (shift down)"; wxLogMessage( "%s", logBuf.c_str() ); + // you must call event skip if you want default grid processing + // ev.Skip(); } @@ -464,7 +467,7 @@ void GridFrame::OnLabelLeftClick( wxGridEvent& ev ) void GridFrame::OnCellLeftClick( wxGridEvent& ev ) { logBuf = ""; - logBuf << "Cell at row " << ev.GetRow() + logBuf << "Left click at row " << ev.GetRow() << " col " << ev.GetCol(); wxLogMessage( "%s", logBuf.c_str() ); @@ -494,6 +497,19 @@ void GridFrame::OnColSize( wxGridSizeEvent& ev ) ev.Skip(); } + +void GridFrame::OnSelectCell( wxGridEvent& ev ) +{ + logBuf = ""; + logBuf << "Selected cell at row " << ev.GetRow() + << " col " << ev.GetCol(); + wxLogMessage( "%s", logBuf.c_str() ); + + // you must call Skip() if you want the default processing + // to occur in wxGrid + ev.Skip(); +} + void GridFrame::OnRangeSelected( wxGridRangeSelectEvent& ev ) { logBuf = "";