Forcing TDBAdvEdit Validation

Is there a way of invoking the OnValueValidate functionality of a TDbAdvEdit without actually changing the value?

That is, I have logic in the OnValueValidate event that displays an error as the user types in a value.

But the value of a given edit might become invalid if some other control on the form changes.

It would be handy if I could link a set of controls together to invoke each other's validation...

For example, I have a a currency combobox with "CAD", "USD", "BOTH", and two TDBAdvEdits:
dbEdtCAD and dbEdtUSD.

If currency is CAD and dbEdtCAD=0 and dbEdtUSD<>0 then dbEdtUSD is invalid.

So, changing the drop down box value from USD to CAD should cause dbEdtUSD to call it's OnValueValidate and see that it is now invalid.

I can manage all this with a common OnChange or OnExit method, but it would be nice to take advantage of the OnValueValidate that already exists...


At this moment, there is not an interface to force this.
We have added a public method DBAdvEdit.Validate with which you can programmatically force this.
This will be available in the next update.

Thanks Bruno!

BTW, the Validate method isn't quite right (it runs validation, but does nothing with results)

In order to get it working I modified it to:


procedure TCustomAdvEdit.Validate;
begin
  IsError:= not  DoValidate(Self.Text);
  if IsError and Enabled and ShowError then
  begin
    ApplyErrorColor;
  end;
end;


This is indeed an improvement.
We will apply it accordingly.