Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OnValidate for a TClientDataSet

I'm trying to write an OnValidate event on a field on a TClientDataSet, something along the lines of

procedure TForm8.ClientDataSet1MyFieldValidate(Sender: TField);
begin
  if Sender.AsFloat > 30 then
     raise Exception.Create('Too Much!!!');
end;

But Sender.AsFloat is always 0 - how do I do field level validation (I realize in this instance I could use constraints or set Min/Max values)

like image 822
Alister Avatar asked Oct 06 '22 03:10

Alister


1 Answers

This is a bug that has been introduced in Delphi XE3, here is the QC report, and a quick movie I've made to illustrate the problem clearly. Hopefully this will be fixed in the next update. There is a hot fix in one of the comments on the QC page if you need this fixed immediately.

like image 93
Alister Avatar answered Oct 10 '22 02:10

Alister