From 8497bbf52d4f7e37a6555040ae7def97d2618fe0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 30 Oct 2006 01:28:15 +0000 Subject: [PATCH] check that the cell using bool editor has a valid value (i.e. either true or false) (last nail in the coffin of the request 1557790) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42696 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/grid.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 623586fbe1..a2994e1679 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1341,7 +1341,19 @@ void wxGridCellBoolEditor::BeginEdit(int row, int col, wxGrid* grid) else { wxString cellval( grid->GetTable()->GetValue(row, col) ); - m_startValue = !( !cellval || (cellval == wxT("0")) ); + + if ( cellval == ms_stringValues[false] ) + m_startValue = false; + else if ( cellval == ms_stringValues[true] ) + m_startValue = true; + else + { + // do not try to be smart here and convert it to true or false + // because we'll still overwrite it with something different and + // this risks to be very surprising for the user code, let them + // know about it + wxFAIL_MSG( _T("invalid value for a cell with bool editor!") ); + } } CBox()->SetValue(m_startValue);