Subject Re: [IBO] IBOQuery: How to create TField for selected fieldsatruntime?
Author Chuck Belanger
Hi, Helen:

Thanks again.

I'm afraid my own ignorance about all this is showing. Frankly, what reading I've
done only confuses it more. I guess I was using the word persistent/non-persistent

I guess I need to ask, "How do I instantiate the TField for a runtime created
IBOQuery/TDataset?" Simply referring to the FieldByName('fieldname') doesn't do
it. I'm trying to avoid have a bunch of IBOQuery components all over my Datamodule
for every little query I do.

As I'm writing, I'm thinking the problem may be here:

I'm declaring an array of TFields. Then assigning each with FieldByName(), but I
guess I need to do something like the following:

FieldArray[i] := TField.Create;
Then assign the FieldByName.

Is this correct?

Actually this may be the answer, now that I look at it. Its a common error on my
part to forget the <Class>.create.

Thanks for bearing with me. You've been helping me with IB, FB and IBO for a long
time now since my move from FoxPro DOS. I really appreciate your help.

I'll try the above first. If still problems, I'll get back.


Helen Borrie wrote:

> At 03:48 PM 4/02/2005 -0800, you wrote:
> >Thanks Helen for taking the time to respond.
> >
> >I already know about native IBO, but I'm talking about TDataSet IBOQuery, not
> >IB_Query. Someone already gave me some pointers on using TIB_Column and
> >OnGetText with the AfterPrepare event.
> >
> >What I still need is the same ability to dynamically assign OnGetText
> >event to a
> >non-persistent TField of the IBOQuery.
> What's a "non-persistent TField"? If you have to write a handler for a
> TField, you have to instantiate it before it can be referenced by the
> handler, i.e. it is by nature a persistent object.
> If you don't instantiate your own field objects in your application code,
> Delphi instantiates dynamic field objects for itself, but your code can't
> access them. What's your objection to instantiating TFields?
> >Any suggestions?
> I suppose you could write a class procedure that generically handles
> GetData and SetData, but I wouldn't want to go there.
> Have you tried accessing the IBODataset's InternalDataset object and
> applying the TIB_Dataset methods, etc. to that? It's not recommended for
> all things but you might consider experimenting with it for your particular
> purpose, since the TIB_Column objects do exist there.
> Helen
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more !
> Yahoo! Groups Links