Subject Re: [IBO] tib_ComboBox
Author Helen Borrie (TeamIBO)
At 10:33 PM 12-08-02 -0400, you wrote:
>My tib_CtrlGrid, linked to TableA, has a nav bar and update bar, a read-only
>control for the key field, and tib_ComboBoxes for the other two fields. The
>idea is to offer two capabilities within the grid: select an existing record
>from the table, and insert a new record.
>
>I would like to populate the items of the tib_ComboBox controls with
>permissible values that come from querying TableB and TableC.
>
>The result would be that items[ 0 ] is from the basic data and items[
>1 ]...items[ n ] come from the queries.
>
>The problem is that, after populating the items of the tib_ComboBoxes, the
>basic data from TableA are no longer visible in the controls.
>
>Perhaps this is just asking too much of the system, and perhaps I should add
>those as separate, ordinary tComboBoxes.

No, I think you are probably not using TIB_Combobox the proper way. It
could have one or some of the following possible causes:

You are trying to use TIB_Combobox with TIBO* datasets. You can't do
that. They are not compatible. (I'm suspicious when you refer to "the
data from TableA" since it sounds as if you are using TIBOTable...)

You are using the datalink "topsy turvey". TIB_Combobox is not double
data-aware. The Datasource property should link to the TIB_Datasource that
points to the parent dataset and the Datafield to the column which is to be
linked to the combobox. You typically use a TIB_Cursor to populate the
drop-down of TIB_Combobox, and you will need to write a procedure to
achieve that. (....A linking datasource component is not required for this
dataset since it is not linked to a control...) This is a place where a
separate transaction can be useful, so that it's possible to update the
combobox without interrupting the transaction in which the editing task is
happening.

Note that TIB_Combobox doesn't provide any live datalinking between its
underlying source of data (e.g. the IB_Cursor that you use to acquire the
items) and the linked parent. In edit mode, the value in the editbox can
be changed by scrolling and/or incremental-searching the drop-down
list. In Browse mode, the editbox of the combobox will either be static on
the item that matches the current parent value; or "empty" if the parent
has null or a non-matchable value.

You *can* supply a "dummy" item in the TIB_Combobox's Items list. Another
trick is that you can (optionally) use the Values property of this control
to store something different to what appears in the DropDown. It's an "all
or nothing" thing - if Values isn't nil, all of the Values items will be
sought; so you need to take care that you have the right values in each
Values item to correspond correctly with the Items member having the same
index.


regards,
Helen Borrie (TeamIBO Support)

** Please don't email your support questions privately **
Ask on the list and everyone benefits
Don't forget the IB Objects online FAQ - link from any page at
www.ibobjects.com