Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

DBAdvGrid OnCellValidate problem

 Post Reply Post Reply
Author
Jutras Kevin View Drop Down
New Member
New Member
Avatar

Joined: 14 Mar 2020
Posts: 13
Post Options Post Options   Quote Jutras Kevin Quote  Post ReplyReply Direct Link To This Post Topic: DBAdvGrid OnCellValidate problem
    Posted: 31 Mar 2020 at 2:48pm
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
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 9195
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 31 Mar 2020 at 9:47pm
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.
Back to Top
Jutras Kevin View Drop Down
New Member
New Member
Avatar

Joined: 14 Mar 2020
Posts: 13
Post Options Post Options   Quote Jutras Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 2:50pm
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 ?
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 9195
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 01 Apr 2020 at 2:52pm
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
Back to Top
Jutras Kevin View Drop Down
New Member
New Member
Avatar

Joined: 14 Mar 2020
Posts: 13
Post Options Post Options   Quote Jutras Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 03 Apr 2020 at 3:05pm
I send you a sample source project
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 9195
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 03 Apr 2020 at 3:06pm
It is on our todolist to investigate
Back to Top
Jutras Kevin View Drop Down
New Member
New Member
Avatar

Joined: 14 Mar 2020
Posts: 13
Post Options Post Options   Quote Jutras Kevin Quote  Post ReplyReply Direct Link To This Post Posted: 04 Apr 2020 at 1:36pm
Thank you very much Bruno
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down