Project JEDI - Issue Tracker - JEDI VCL
Viewing Issue Advanced Details
5456 00 JVCL Components minor always 2011-01-13 11:19 2011-09-21 14:10
bongos  
AHUser  
normal  
resolved Daily / GIT  
fixed  
none    
none 3.45  
0005456: JvValidateEdit/JvCustomEdit OnChange event called on Component Loading
The OnChange event of a TjvCustomEdit derivative is called when the component is loaded which is not the behaviour that is expected.
Recreate by putting TjvValidateEdit on a form, set a value and the OnChange event and run. The Onchange event is fired upon creation of the form.

I have currently fixed it for myself by changing the following:

In TjvCustomEdit.SetText(const Value: TCaption), change the line (

inherited Text := Value;

to

Perform(WM_SETTEXT, 0, LongInt(PChar(Value)));

Issue History
2011-01-13 11:19 bongos New Issue
2011-01-13 12:12 bongos Note Added: 0018296
2011-02-15 13:48 obones Note Added: 0018350
2011-02-15 13:48 obones Status new => feedback
2011-02-16 18:53 AHUser Note Added: 0018384
2011-02-16 18:53 AHUser Status feedback => resolved
2011-02-16 18:53 AHUser Fixed in Version => Daily / SVN
2011-02-16 18:53 AHUser Resolution open => fixed
2011-02-16 18:53 AHUser Assigned To => AHUser
2011-09-21 14:10 obones Fixed in Version Daily / SVN => 3.45

Notes
(0018296)
bongos   
2011-01-13 12:12   
Forgot to mention slight alteration to TJvCustomValidateEdit for this bug, to set the EditText to the formatted value before considering csLoading

procedure TJvCustomValidateEdit.Loaded;
begin
  // set the EditText to the formatted value before taking csLoading from ComponentState, to allow eg.skipping of OnChange
  DataConnector.Active := False;
  try
    EditText := FEditText;
  finally
    DataConnector.Active := True;
  end;
  inherited Loaded;
  // (obones) Why is this necessary? It overrides DecimalPlaces set to 0 by the user
{ if DisplayFormat = dfCurrency then
    if FDecimalPlaces = 0 then
      FDecimalPlaces := CurrencyDecimals;}
end
(0018350)
obones   
2011-02-15 13:48   
Please provide the zipped sources of a sample application showing this.
(0018384)
AHUser   
2011-02-16 18:53   
Fixed in svn revision 12986.

As far as I can see this can only happen if you use visual inheritance because then the OnChange event handler can be assigned before the Value property.