Browse Source

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
pull/16/head
Seth Hillbrand 5 years ago
parent
commit
05a89863c5
  1. 9
      common/grid_tricks.cpp

9
common/grid_tricks.cpp

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

Loading…
Cancel
Save