Hello!
what is wrong with this code:
TViewCrudDoc.TMSFMXGrid1ClipboardBeforePasteCell procedure (Sender:
TObject; Col, Row: Integer; var Value: string; var Allow: Boolean);
var cell: TCell;
begin
cell: = TMSFMXGrid1.XYToCell (col, row);
TMSFMXGrid1.EditCell (cell);
end;
the XYToCell always returns the cell (0,0).
I need to do is put the cell in edit before Paste to force the OnCellEditValidateData event is executed.
Thank you.
Hi,
TObject; Col, Row: Integer; var Value: string; var Allow: Boolean);
var cell: TCell;
begin
cell.Row := Row;
end;
:) Sorry Pieter, it seems logical now, but have not found documentation on the function.
But I still have a problem:
if you do this at the event
TViewCrudDoc.TMSFMXGrid1ClipboardBeforePasteCell procedure (Sender:
TObject; Col, Row: Integer; var Value: string; var Allow: Boolean);
var cell: TCell;
begin
cell.Row: = Row;
cell.Col: = Col;
TMSFMXGrid1.EditCell (cell);
end;
the cell is being edited but the value is not copied.
need the GetCellEditorType event runs to take the initial value of the cell
TtViewGridCRUD.GetCellEditorType procedure (Sender: TObject; Acol, Arow: Integer; CellEditorType var: TTMSFMXGridEditorType);
begin
ValueBegoreEdit: = Grid.Cells [Acol, Arow];
end;
and in the event
TtViewGridCRUD.CellEditValidateData procedure (Sender: TObject; Acol,
Arow: Integer; CellEditor: TFmxObject; CellString var: string; var
Allow: Boolean);
begin
ValueBegoreEdit if <> then CellString
DoMyValidate (Sender, Acol, Arow, CellEditor, ValueBegoreEdit, CellString, Allow);
end;
how can I do that these events are executed?
Thank you.
You will need to validate the data inside the OnClipBoardBeforePasteCell. You can block copying, or change the value that will be pasted. The original value can be retrieved with TMSFMXGrid.Cells[Col, Row].