[fpc-devel] Recent changes to TField.SetData

Martin Schreiber mse00000 at gmail.com
Mon Apr 4 07:45:37 CEST 2011


Am 04.04.2011 07:29, schrieb Michael Van Canneyt:
>
>
> On Mon, 4 Apr 2011, LacaK wrote:
>
>> But It seems to me, that DataChanged is now called 2 times
>>
>> First in TDataSet descendants in SetFieldData method (see
>> bufdataset.pas, dbf.pas, paradox.pp, meds.pp) and second in above
>> mentioned place.
>>
>> So it would be good remove this call from TDataSet descendants. For
>> example for bufdataset.pas:
>>
>> 1860 if not (State in [dsCalcFields, dsFilter, dsNewValue]) then
>> 1861 DataEvent(deFieldChange, Ptrint(Field));
>
> Hm. No, we'll remove the call from TField.
>
> There may be other descendants (AnyDac, Zeos and whatnot) that also call
> DataEvent
> and OnValidate, and we cannot apply this change on them.
>
Thanks. For example the code in tmsebufdataset:
"
procedure tmsebufdataset.setfielddata(field: tfield; buffer: pointer);

var
  po1: pointer;
  datasize: integer;
begin
  field.validate(buffer);
  po1:= getfieldbuffer(field,buffer = nil,datasize);
  if buffer <> nil then begin
   move(buffer^,po1^,datasize);
  end
  else begin
   fillchar(po1^,datasize,0);
  end;
  fieldchanged(field);
end;
"

Martin



More information about the fpc-devel mailing list