Subject Re: [IBO] TIB_Combobox
Author Helen Borrie
At 06:04 PM 31/05/2005 +0000, you wrote:
>After searching the messages here am I the only one who can't seem to
>figure out how to get the TIB_Combobox to use the ItemValues property?
>
>I've got a TIB_Combobox on a form and I want to use it as a simple
>True/False selector. I've set the style to csDropDownList and I've
>set the ItemValues property to (False=0, True=1).
>
>Why can't I get this too work?
>
>What am I not understanding?

It is the actual VALUES of the items you want, not an expression. So, in
the Items property, store the values you want the user to see:

MyComboBox.Items.Clear;
MyComboBox.Items.Add('True');
MyComboBox.Items.Add('False');

Or, in the IDE stringlist editor, this would be:

True
False

And in ItemValues, store the values that you want to link to the set that's
using it, ensuring that you have exact correspondence between the indexes
of the two lists:
MyComboBox.ItemValues.Clear;
MyComboBox.ItemValues.Add('1');
MyComboBox.Items.Add('0');

In the IDE stringlist editor:

1
0

If ItemValues is empty, IBO uses (or tries to use) the value that's in the
Items property so, in your case, 'True' or 'False' would blow up in your face.

>I also couldn't get the TIB_Checkbox to work either (same datafield).
>Which is why I went with the TIB_Combobox.

TIB_CheckBox is a genuine Boolean selector, not a list selector. To use
it, you need to tell IBO that the datafield is a Boolean. Like with all
native IBO stuff, you do this in the actual column attributes, at either
Connection or Dataset level:

At Connection level, in ColumnAttributes, with FieldEntryTypes set to
include fetSQLType:

aTable.ThisField=BOOLEAN=1,0

Or, at dataset level:
ThisField=BOOLEAN=1,0

You can set the dataset property in the Fields Editor.

TIB_Checkbox represents null as a greyed-out checkmark. TIB_Combobox of
course doesn't have a way to represent null, so it has its limitations with
respect to nullable columns.

Helen