[fpc-devel]FCL TField.GetCanModify wrong?

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Sun Sep 14 15:30:18 CEST 2003


On Sat, 13 Sep 2003, Andrew Johnson wrote:

> 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.

You are of course right. I have adapted the sources accordingly, and
committed in CVS.

Michael.





More information about the fpc-devel mailing list