X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4693b20c7500190c3cc8c02919c45436bf5efbc9..922ba68045d84789ab1dfceb4d1aa1b6e2c5e810:/samples/newgrid/griddemo.cpp diff --git a/samples/newgrid/griddemo.cpp b/samples/newgrid/griddemo.cpp index aaf3bebcd5..e78e342be9 100644 --- a/samples/newgrid/griddemo.cpp +++ b/samples/newgrid/griddemo.cpp @@ -249,6 +249,8 @@ GridFrame::GridFrame() grid->SetCellValue( 0, 2, "Blah" ); grid->SetCellValue( 0, 3, "Read only" ); grid->SetReadOnly( 0, 3 ); + + grid->SetCellValue( 0, 4, "Can veto edit this cell" ); grid->SetCellValue( 0, 5, "Press\nCtrl+arrow\nto skip over\ncells" ); @@ -808,6 +810,17 @@ void GridFrame::OnCellValueChanged( wxGridEvent& ev ) void GridFrame::OnEditorShown( wxGridEvent& ev ) { + + if ( (ev.GetCol() == 4) && + (ev.GetRow() == 0) && + (wxMessageBox(_T("Are you sure you wish to edit this cell"), + _T("Checking"),wxYES_NO) == wxNO ) ) { + + ev.Veto(); + return; + } + + wxLogMessage( wxT("Cell editor shown.") ); ev.Skip(); @@ -815,6 +828,16 @@ void GridFrame::OnEditorShown( wxGridEvent& ev ) void GridFrame::OnEditorHidden( wxGridEvent& ev ) { + + if ( (ev.GetCol() == 4) && + (ev.GetRow() == 0) && + (wxMessageBox(_T("Are you sure you wish to finish editing this cell"), + _T("Checking"),wxYES_NO) == wxNO ) ) { + + ev.Veto(); + return; + } + wxLogMessage( wxT("Cell editor hidden.") ); ev.Skip();