Subject Re: [IBO] IBOQuery: How to create TField for selected fields at runtime?
Author Helen Borrie
At 10:14 AM 4/02/2005 -0800, you wrote:

>Hello:
>
>I'm hoping this has an easy answer, for some reason I can't find it in
>any documentation.
>
>Using IBOQuery and IB_Query in my program. IBO because I'm using
>Woll2Woll components. I'm doing some encryption of some of the fields in
>some of the tables in my Firebird DB. Many of my queries are SQL.Add's
>to a few query utilities, like qryAnyUse1, etc.
>
>What I'd like to do is assign OnGetText events at runtime to the various
>necessary fields to decrypt the field text.
>
>I got some wonderful help from someone recently here on how to add
>OnGet/SetText for the IB_query components, but how do I create a TField
>at runtime, so that I can assign the OnGetText then?
>
>It seems that the only way I can create a TField is to make the qry
>persistent in a IBOquery component, then use the Objects treeview to Add
>Fields via the menu. It seems reasonable that I should be able to do
>this via the program, but how?
>
>I tried variations of Sender.FieldByName('field name').OnGetText :=
><Name of Routine> but the program keeps sqwaking about the field isn't
>found or something like that.

Native IBO doesn't use TField objects at all. It creates TIB_Column
objects for each column when the statement is prepared. As long as you
have custom behaviour defined for the column's OnGetText, the var AValue is
returned each time you refer to the column's AsString method.

Helen