]> git.saurik.com Git - wxWidgets.git/commitdiff
check that the cell using bool editor has a valid value (i.e. either true or false...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 30 Oct 2006 01:28:15 +0000 (01:28 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 30 Oct 2006 01:28:15 +0000 (01:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42696 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index 623586fbe1a78a95a240169196f5f3d2c21f1286..a2994e167915ceb41b0d8827e908f7bc01a8426c 100644 (file)
@@ -1341,7 +1341,19 @@ void wxGridCellBoolEditor::BeginEdit(int row, int col, wxGrid* grid)
     else
     {
         wxString cellval( grid->GetTable()->GetValue(row, col) );
     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);
     }
 
     CBox()->SetValue(m_startValue);