Subject Re: [IBO] Embending IBLoockupCombo in IB_Grid
Author Helen Borrie
At 05:27 PM 26/01/2004 +0000, you wrote:
> I would like to place 1 IB_LockupCombo inside of an IB_Grid but I
>don't know as doing this.
> I already analyzed the examples Contact and Company and I didn't
>get to find which the propriedade/metodo that make this connection.
> Somebody could help me.
> Thanks.

There are simply dozens of descriptions in the list archives. Here's a
snip from one I sent out recently:

Lookups in IBO are entirely data-driven. There is a detailed demonstration
of embedding a TIB_LookupCombo control in a TIB_Grid, with the necessary
data linkages, in the Getting Started guide, which you can purchase for
$29.50 from the IBO shop. In the various TechInfo sheets on Controls and
Datasets, there is similar information with less detail.

In brief:

1. Set up the lookup structure between the lookup dataset and the main
query by linking the lookup dataset's KeySource property to the
ib_datasource of the main query.

2. Set up the relationship between the primary key of the lookup dataset
and the lookup key of the main query in the Keylinks property of the lookup

3. You may also want to use KeyDescLinks in the lookup dataset to link the
description field of the lookup dataset to a subquery in the main dataset
that fetches the description as a run-time field (computed field).
e.g. main query

// next is for displaying the description instead of the key value
(select lu.Description from TheLookupTable lu
where lu.PrimaryKey = mt.ALookupKey) as TheDescription
from MainTable mt
where ....

Make the Visible property of TheLookupKey false.

The lookup dataset would be
from TheLookupTable

Make the Visible attribute of ThePrimaryKey false.

KeyLinks for MyLookupQuery would be

KeyDescLinks for MyLookupQuery would be

That's the data setup. Now just put the lookup query into a
tib_LookupCombo and set the DisplayField to Description. Test it outside
the grid. When it's working, just select it, do Ctrl-X to cut it into the
clipboard, then select the grid and do Ctrl-V to embed it into the grid.

When you run your project and place the dataset in Edit mode, the drop-down
lookup will appear in place of either TheLookupKey (if you didn't use
KeyDescLinks) or TheDescription (if you did use KeyDescLinks).

Hope this helps.