Subject | Re: [IBO] Lookup controls |
---|---|
Author | Helen Borrie |
Post date | 2002-09-10T00:55:06Z |
At 08:17 PM 09-09-02 -0400, you wrote:
values) then use an IB_Combobox. In your FormCreate, just pull the values
in via a TIB_Cursor and feed them into the Items of the combobox.
To bind the lookup item to the parent column, point the Datasource property
of the control o the datasource of the parent dataset and Datafield points
to the column you want to populate. (You can also use IB_Combobox unbound
and just read the Item after selection...)
Here's how to load the combobox:
...
with myCursor, myCombo do
begin
if not Prepared then Prepare;
if not Active then First;
Clear;
while not EOF do
Items.Add(FieldByName('TheValue').AsString);
Close;
Unprepare;
end;
...
If the data feeding your comboboxes are likely to be a bit dynamic (change
throughout the user's session), put this code into a procedure that can be
called again during runtime.
Tip: to avoid messups it's a good idea to have your IB_Cursor's statement
eliminate the possibility of blanks or nulls in TheValue.
Helen
>Hello:Sure. If you are just going to use the lookups this way (i.e. static
>
>i am having difficulty conceptualizing the IBLookup controls and their
>purpose. My intention is to use many different small tables to provide
>"lookup" values to facilitate data entry, for instance, a small table with
>('Mr.', 'Mrs.', 'Miss', etc...) that fits into the lookup portion of a
>lookup list, but populates within a table called "Clients" a field called
>"PersonTitle", for example... This is not going to be a Master-Detail
>relationship, i just want to hold the data for the lookups in a table in the
>database, rather than in a file as a stringlist...
>
>my question is: is this the way it is done?
values) then use an IB_Combobox. In your FormCreate, just pull the values
in via a TIB_Cursor and feed them into the Items of the combobox.
To bind the lookup item to the parent column, point the Datasource property
of the control o the datasource of the parent dataset and Datafield points
to the column you want to populate. (You can also use IB_Combobox unbound
and just read the Item after selection...)
Here's how to load the combobox:
...
with myCursor, myCombo do
begin
if not Prepared then Prepare;
if not Active then First;
Clear;
while not EOF do
Items.Add(FieldByName('TheValue').AsString);
Close;
Unprepare;
end;
...
If the data feeding your comboboxes are likely to be a bit dynamic (change
throughout the user's session), put this code into a procedure that can be
called again during runtime.
Tip: to avoid messups it's a good idea to have your IB_Cursor's statement
eliminate the possibility of blanks or nulls in TheValue.
Helen