Browse Source

* Added OnValidate event support (17510)

git-svn-id: trunk@17220 -
michael 14 years ago
parent
commit
e8cf8e4177
1 changed files with 8 additions and 0 deletions
  1. 8 0
      packages/fcl-db/src/base/fields.inc

+ 8 - 0
packages/fcl-db/src/base/fields.inc

@@ -820,7 +820,15 @@ procedure TField.SetData(Buffer: Pointer; NativeFormat : Boolean);
 begin
 begin
   If Not Assigned(FDataset) then
   If Not Assigned(FDataset) then
     DatabaseErrorFmt(SNoDataset,[FieldName]);
     DatabaseErrorFmt(SNoDataset,[FieldName]);
+  if (FieldNo>0) and not (FDataSet.State in [dsSetKey, dsFilter]) then
+    begin
+    if ReadOnly then 
+      DatabaseErrorFmt(SReadOnlyField, [DisplayName], Self); 
+    Validate(Buffer);
+    end;
   FDataSet.SetFieldData(Self,Buffer, NativeFormat);
   FDataSet.SetFieldData(Self,Buffer, NativeFormat);
+  if not (FDataSet.State in [dsCalcFields, dsFilter, dsNewValue]) then
+    DataChanged;
 end;
 end;
 
 
 Procedure TField.SetDataset (AValue : TDataset);
 Procedure TField.SetDataset (AValue : TDataset);