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
This commit is contained in:
Vadim Zeitlin 2006-10-30 01:28:15 +00:00
parent 6f6dd276a8
commit 8497bbf52d

View File

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