[fpc-devel]FCL TField.GetCanModify wrong?

Andrew Johnson ajgenius at ajgenius.us
Sun Sep 14 00:16:49 CEST 2003


I have been trying to make a db-aware edit control for the lcl and
getting nowhere and its as far as I can tell because Field.GetCanModify
is always false so it is never editable. Looking through the fcl sources
I find this function -

function TField.GetCanModify: Boolean;

begin
  Result:=Not ReadOnly;
  If Result then
    begin
    Result:=Assigned(DataSet);
    If Result then
      Result:=Not(DataSet.CanModify);
    end;
end;

and since Datset.CanModify is almost always going to be true, if editing
then this always validates false. in fact right now that function always
returns true anyway. so this will always be wrong. I think it should be 

    If Result then
      Result:= DataSet.CanModify;

I worked passed this for now by using my own routine which does the test
like this and it works fine for me.

Andrew





More information about the fpc-devel mailing list