support for vetoing grid cell editing (patch 469049)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-11-02 17:44:55 +00:00
parent f8a4fa4c99
commit fe7b9ed6fd
4 changed files with 79 additions and 21 deletions

View File

@@ -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();