The first is the ability to easily add a new row at the end of the grid. With some simple code it is possible to always have an empty row at the end of the grid, so users can simply go to that line and start typing data: a new row will pop up at the end of the grid and so on...
All we need to do is handling the EVT_GRID_SELECT_CELL event:
void fsGridBase::OnSelectCell( wxGridEvent& event )
{
int row = event.GetRow();
int lastRow = GetTable()->GetNumberRows() - 1;
if( row == lastRow ) {
AppendRows( 1 );
}
event.Skip();
}
as soon as a cell is selected in the last row a new row is appended. This makes the grid behaviour more similar to the one of a spreadsheet.
No comments:
Post a Comment