Subject | [IBO] Re: Many dblookup combo |
---|---|
Author | svein_erling |
Post date | 2002-08-09T08:29:45Z |
Set the SQL for your TIB_Cursor as well as other properties like connection and transaction and then do - e.g. in your FormShow method - something like:
var
MyItem, MyItemValue: TIB_Column;
begin
if not MyCursor.Prepared then
MyCursor.Prepare;
MyItem:=MyCursor.FieldByName('ColumnWithItem');
MyItemValue:=Mycursor.FieldByName('ColumnWithItemValue');
MyCursor.First;
MyFirstComboBox.Items.Clear;
MyFirstComboBox.ItemValues.Clear;
while not MyCursor.eof do begin
MyFirstComboBox.Items.Add(MyItem.AsString);
MyFirstComboBox.ItemValues.Add(inttostr(MyItemValue.AsInteger));
MySecondComboBox.Items.Add(MyItem.AsString);
MySecondComboBox.ItemValues.Add(inttostr(MyItemValue.AsInteger));
MyCursor.Next;
end;
MyCursor.Close;
MyCursor.UnPrepare; //This is optional
end;
I have not tested this code, but it is pretty straight forward so I think the main source of error will be spelling mistakes.
HTH,
Set
var
MyItem, MyItemValue: TIB_Column;
begin
if not MyCursor.Prepared then
MyCursor.Prepare;
MyItem:=MyCursor.FieldByName('ColumnWithItem');
MyItemValue:=Mycursor.FieldByName('ColumnWithItemValue');
MyCursor.First;
MyFirstComboBox.Items.Clear;
MyFirstComboBox.ItemValues.Clear;
while not MyCursor.eof do begin
MyFirstComboBox.Items.Add(MyItem.AsString);
MyFirstComboBox.ItemValues.Add(inttostr(MyItemValue.AsInteger));
MySecondComboBox.Items.Add(MyItem.AsString);
MySecondComboBox.ItemValues.Add(inttostr(MyItemValue.AsInteger));
MyCursor.Next;
end;
MyCursor.Close;
MyCursor.UnPrepare; //This is optional
end;
I have not tested this code, but it is pretty straight forward so I think the main source of error will be spelling mistakes.
HTH,
Set
--- In IBObjects@y..., "Medicusit" <medicusit@y...> wrote:
> > Alternatively if the items of the LookupCombo are reasonably static, you
> could use TIB_ComboBoxes rather than TIB_LookupCombos. Then you could use a
> TIB_Cursor to populate the TIB_ComboBoxes.
> >
> > Whether this is useful or not, all depends on your requirements.
> >
> > HTH,
> > Set
>
> Yes, it's good solution. Could you give me a way to realize this?
>Thanks
>
> Med