TStringGrid empty cells does not replace cells with data when copy and paste one empty cell or one column with empty cell.
Original Reporter info from Mantis: K155LA3
-
Reporter name:
Original Reporter info from Mantis: K155LA3
- Reporter name:
Description:
If you copy one empty cell or one column with empty cell and paste it in cell with data, than cells does not replace cells with data.
Steps to reproduce:
1 Place StringGrid to form.
2 Set in Options goEditing.
3 Run programm.
4 Fill some cell with any data.
5 Select one empty cell and press Ctrl+C.
6 Place cursor on cell with data and press Ctrl+V
7 Nothing happens.
8 Select one column with empty cell and press Ctrl+C.
9 Place cursor on column with data and press Ctrl+V
10 If in the copied column there are empty cells, then it is not replaced the cell with data.
Additional information:
In procedure TCustomStringGrid.SelectionSetText(TheText: String):
If copy one empty cell TheText = '' and after "L.Text := TheText" L.Count = 0 and cycle "for j:=0 to L.Count-1 do" not execute.
Because function "GetNextLine (Value,S,P)" in procedure "TStrings.SetTextStr(const Value: string) - > DoSetTextStr(Value,True) -> GetNextLine (Value,S,P)" when Value = '' do nothing.
If column with empty cell L[j] = '' and after "SubL.DelimitedText := L[j];" SubL.Count = 0 and cycle "for i:=0 to SubL.Count-1 do" not execute.
Because procedure "TStrings.SetDelimitedText(const AValue: string)" when AValue = '' do nothing.
May be it is problem of TStrings class. But now this bug for TCustomStringGrid may be fix with additional check:
procedure TCustomStringGrid.SelectionSetText(TheText: String);
...
L.Text := TheText;
if (TheText = '') and (L.Count = 0) then L.Add(''); //additional check (copy one empty cell)
...
SubL.DelimitedText := L[j];
if (L[j] = '') and (SubL.Count = 0) then SubL.Add(''); //additional check (copy one column with empty cell)
Mantis conversion info:
- Mantis ID: 30556
- OS: Windows
- OS Build: 7
- Build: Rev. 51630
- Version: 1.7 (SVN)
- Fixed in version: 1.7 (SVN)
- Fixed in revision: 52976 (#c3d5c5e2)
- Target version: 1.8