GRID_TRICKS: Ensure destinations can take value

Cut/Paste need to set values in the table.  We need to check that the
destination can take the string values before blindly setting.

Fixes https://gitlab.com/kicad/code/kicad/issues/4724
This commit is contained in:
Seth Hillbrand 2020-06-26 09:06:02 -07:00
parent 19b7755ab7
commit 05a89863c5
1 changed files with 7 additions and 2 deletions

View File

@ -572,6 +572,8 @@ void GRID_TRICKS::paste_text( const wxString& cb_text )
cols.SetString( rowTxt, COL_SEP, wxTOKEN_RET_EMPTY );
wxString cellTxt = cols.GetNextToken();
if( tbl->CanSetValueAs( row, col, wxGRID_VALUE_STRING ) )
tbl->SetValue( row, col, cellTxt );
}
}
@ -596,8 +598,11 @@ void GRID_TRICKS::cutcopy( bool doCut )
txt += COL_SEP;
if( doCut )
{
if( tbl->CanSetValueAs( row, col, wxGRID_VALUE_STRING ) )
tbl->SetValue( row, col, wxEmptyString );
}
}
txt += ROW_SEP;
}