AdvStringgrid ClipboardBeforePasteCell

Good morning,

I expected using the grid.ClipboardBeforePasteCell() method to be able to go to a specified cell and then paste the clipboard data in that cell.

However,I see that the focus is set on that specified cell, but that the "paste" still takes place on the cell where I originally stood.

See this code:

procedure TfmMain.sgSFClipboardBeforePasteCell(Sender: TObject; ACol,
ARow: Integer; var Value: string; var Allow: Boolean);
begin
sgSF.GotoCell(1,1);
end;

also sgSF.FocusCell(1, 1); will not work.

What am I doing wrong.

With kind regards,
Frans

image

Using OnClipboardPaste() instead of ClipboardBeforePasteCell() solves the problem.

procedure TfmMain.sgSFClipboardPaste(Sender: TObject; var Allow: Boolean);
begin
sgSF.GotoCell(1,1);
allow := true;
end;

Regards,
Frans

OnClipboardBeforePasteCell is intended to offer manipulation or validation of the text effectively to be pasted in the cell where the user selected to do a paste, not to change the location of the paste.