TAdvEdit onValueValidate fires upon create?

Hi


When using TAdvEdit is normally would use onValueValidate to validate any user input.

But it seems this event triggers when showing the component?

To Reproduce possible error.
New VCL forms application.
Place TAdvEdit anywhere
in onValueValidate set Caption := Value;
Run

Caption of form will now be AdvEdit1

Is this as per design?

This is to show the correct validity state when the form comes up.
Also when the value is set at design time for example, or initialized in a form constructor, we thought it was meaningful to be able to show a validity state.

ok i have found a workaround for me.


But still i see some problems with this appoach.

Example ... having 2 advEdits depending on one another... running this does not produce what I would expect.

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, AdvEdit;

type
  TForm1 = class(TForm)
    AdvEdit1: TAdvEdit;
    AdvEdit2: TAdvEdit;
    procedure FormCreate(Sender: TObject);
    procedure AdvEdit1ValueValidate(Sender: TObject; Value: string; var IsValid: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.AdvEdit1ValueValidate(Sender: TObject; Value: string; var IsValid: Boolean);
begin
  advEdit2.Text := advEdit1.Text;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  advEdit2.Text := '';
end;

end.

But ... as said - I've found my workaround ... and can use that for now.

forgot to mention - advEdit2 is readonly .... sry.

But then again - this could perfectly show your intention .... 

just not what I expected :-)
I would expect a blank AdvEdit2.Text ... until AdvEdit1.Text gets changed. (not in creation / showing the form) ..

But perhaps you can elaborate on this?

It is expected that AdvEdit2.Text will be AdvEdit1.
AdvEdit1 and AdvEdit2 get created first, after creation the value is set, so setting of value of AdvEdit1 happens after creation of AdvEdit2 and thus OnValueValidate overwrites text in AdvEdit2.