DBAdvGrid OnCellValidate problem

Hi TMS Support team,


Here is the explanation of my problem. I have a grid with my table columns. I have a "date column" (the one that I want to validate) and the column beside it is a "checkbox column" (edDataCheckBox).

On my "date column", I want to validate if the date is today and later. Here is the code :
  if ((Sender as TDBAdvGrid).FieldAtColumn[ACol].FieldName = 'order_date') and
     (StrToDatedef(Value, Date) < Date) then
  begin
    ShowMessage('wrong date');
    Valid := False;
  end;

When I click on any other columns, it works. The message appears and it focus back to my "date column".
But if I click on the "checkbox column", the message appears twice and my checkbox disappears. The focus don't go back to my "date column".

Thanks for the help

You should never call functions that force the focus away from the grid from the OnCellValidate event. Taking the focus from the grid affects the process of stopping editing (it also causes that editing stops).

If you want to show a message in a way that it takes the focus away, do this from the OnCellEditDone. This event is triggered when the editing fully stopped and thus, taking the focus away from the grid won't affect the editing process anymore.

Hi Bruno,

The problem is not the showmessage, because it's working. The problem is when I change the date, after I click on the "checkbox column" and then the checkbox disappears. After that I click on any other columns and the checkbox re-appears.

I remove my showmessage and the problem is still there.
My code is working in the OnCellValidate, because all I do is to set Valid := False;
But I want to understanda why the checkbox disappears for no reason ?

I will need details / full grid settings , preferably a sample source project with which this can be reproduced with the latest version 2.5.0.7 of TDBAdvGrid

I send you a sample source project

It is on our todolist to investigate

Thank you very much Bruno