DBAdvEdit.OnExit started late

Hi

I found an interesting thing.

2 forms, and 1 DBAdvEdit, some other control.

Form2:
The DBAdvEdit have an OnExit event.
The DbAdvEdit get the focus.
I exit from DBAdvEdit and it's form with press ESC key.
The OnExit event didnt started.

In Form1 do Form2.ShowModal again;
When the Form2.FormShow run, the DbAdvEdit.OnExit start.
DbAdvEdit start, when in Form2.FormShow at line SomeControl.SetFocus.

The Onexit do this not only with 1 DbAdvEdit, and not only with 1 form, but i didnt made standalone sample for this problem.

I hope i wrote understandable, but it's late, I go to bed.

Thanks in advance

Windows 7, Delphi XE, TMS CP 7.1, TMS CP 7.2.2

Please
provide a ready to run project ( mailto support@tmssoftware.com)
that demonstrates the issue so the responsible developer can investigate this
further.


OK.
File.New.VCL Forms Application.
File.New.Form.
You have 2 forms.

Place to Form1 a button, and button's Onclick=  Form2.showmodal;
Form1 ready.

Place to Form2
- two DBAdvEdit
- one bitbtn, kind=bkCancel
Make DBAdvEdit2.OnExit proc, fox example   BitBtn1.Caption:='DBAdvEdit2.OnExit '+datetimetostr(now) ;
Place a breakpoint to OnExit proc.
On Form2.Onshow=   DBAdvEdit1.SetFocus;

RUN.
Click form1.button.
We arrived to Form2.DBAdvEdit1.
TAB.
ESC
We arrived to Form1, but DBAdvEdit2.OnExit proc didnt start.
Click form1.button.
We arrived to Form2, and at line "DBAdvEdit1.SetFocus", the DBAdvEdit2.OnExit proc start now (the breakpoint indicate this).

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Form2.showmodal;
end;

end.



unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, AdvEdit, DBAdvEd, Buttons;

type
  TForm2 = class(TForm)
    DBAdvEdit1: TDBAdvEdit;
    DBAdvEdit2: TDBAdvEdit;
    BitBtn1: TBitBtn;
    procedure DBAdvEdit2Exit(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

uses Unit1;

{$R *.dfm}


procedure TForm2.DBAdvEdit2Exit(Sender: TObject);
begin
  BitBtn1.Caption:='DBAdvEdit2.OnExit '+datetimetostr(now) ;
end;


procedure TForm2.FormShow(Sender: TObject);
begin
  DBAdvEdit1.SetFocus;
end;

end.

Sorry, it cannot be reproduced with these instructions.

Critical information missing for example is the TabOrder of the controls on the 2nd form.
So, therefore, we asked for a project with which we can reproduce this issue. This immediately avoids a lot of guesswork and trial & error on our side!

I send the example, but I think the critical is the human interaction:


Please put a breakpoint to Form2.DBAdvEdit2Exit line (BitBtn1.Caption:=...)

Run.



Click form1.button: We arrived to Form2.DBAdvEdit1

Press TAB key = We arrived to Form2.DBAdvEdit2

Press ESC key = We arrived to Form1, but DBAdvEdit2.OnExit proc didnt start.

Click form1.button = We arrived to Form2, and at line
"DBAdvEdit1.SetFocus", the DBAdvEdit2.OnExit proc start (the breakpoint
indicate this).

We retested this once more and could now reproduce this behavior.
However, we have tested the same scenario with standard VCL TEdit controls and exactly the same behavior happens, so this is not an issue specific to TDBAdvEdit.

Uff, the problem above our level.

Thanks the test.