TTMSFMXGrid OnCellEditValidateData

HI,


Using the event OnCellEditValidateData, what is the best way to notify the user of validation errors?

In TAdvStringGrid OnCellValidate we use this:

           grd.InvalidEntryTitle := 'Input error';
           grd.InvalidEntryText := 'Entry is mandatory';
 
Couldn't see anything in the documentation.

Is there an equivalent?

Dave

Hi, 


There is currently no equivalent.
We have added this on our feature request list.

OK, thanks. We'll sort something out ourselves then.


Dave

Any hints on how to stay in an invalid cell?


I can display a message, but I want to stay ion the focused cell until is valid or maybe escape pressed to revert.

Dave

Keeping the editor from closing is currently not supported, but you could force back the editor if the validation fails, by using the following code:

  private
    { Private declarations }
    FCellValidate, FBlockCellSelection: Boolean;
    FCell: TCell;
  public
    { Public declarations }
  end;

procedure TForm1.TMSFMXGrid1CellEditValidateData(Sender: TObject; ACol,
  ARow: Integer; CellEditor: TFmxObject; var CellString: string;
  var Allow: Boolean);
begin
  FCell := Cell(ACol, ARow);
  FCellValidate := False;
  Allow := FCellValidate;
end;

procedure TForm1.TMSFMXGrid1SelectedCell(Sender: TObject; ACol, ARow: Integer);
begin
  if FBlockCellSelection then
    Exit;

  if not FCellValidate then
  begin
    FBlockCellSelection := True;
    TMSFMXGrid1.SelectCell(FCell);
    TMSFMXGrid1.EditCell(FCell, csEnd);
    FBlockCellSelection := False;
  end;
end;