[Lazarus] Can't create calculated field

Mattias Gaertner nc-gaertnma at netcologne.de
Tue Jan 1 22:17:02 CET 2013


On Tue, 1 Jan 2013 11:54:43 -0800 (PST)
Alejandro Gonzalo <parkingspace26 at yahoo.com> wrote:

> Try this:
> In the interface part of the form unit insert this prototype into the Private declarations:
>  
> private
>     { Private declarations } 
>     Procedure OnCalcFields(DataSet: TDataSet);  // insert this
>  
> Early in the implementation part insert the event procedure:
>  
> Procedure TForm1.OnCalcFields(DataSet: TDataSet);  
> begin
>     SQLQuery1.FieldByName('calc').AsBoolean := true;
>  end;
>  
> Then after creating your "f" field:
>    f.DataSet   := SQLQuery1.FieldDefs.Dataset; 
>    SQLQuery1.OnCalcFields:=OnCalcFields;  // insert this line
> Dealing with events without using the Object Inspector can be tricky!

Hint:
You can write
SQLQuery1.OnCalcFields:=|
Then press Shift+Ctrl+C (Code completion) and the OnCalcFields will be
created automatically.

Mattias




More information about the Lazarus mailing list