void MyFrame::OnGridCellLeftClick(wxGridEvent& event) { int row = event.GetRow(); int col = event.GetCol(); wxString value = m_grid->GetCellValue(row, col); // do something with the cell value }
void MyFrame::OnGridRangeSelect(wxGridRangeSelectEvent& event) { wxArrayInt rows; wxArrayInt cols; event.GetSelectedRows(rows); event.GetSelectedCols(cols); // do something with the selected cells }This function is called when the user selects a range of cells in the grid. It gets the indices of the selected rows and columns from the event object using the GetSelectedRows() and GetSelectedCols() methods. wxGridEvent is part of the wxWidgets core library, which is included in most standard distributions of wxWidgets.