Subject RE: [IBO] Re: Many dblookup combo
Author Ales Kahanek
Very good solution is to use TIB_ComboBoxEnh from Geoff Worboys. You can
define your own method which is automatically called when the combo is
created. Then on the basis of the combo's DataSource and DataField property
you can easilly fill the combo.Items property (display text=value).
You can write only one clever procedure which can fill every combo in your
application.
Ales

> -----Original Message-----
> From: svein_erling [mailto:svein.erling.tysvaer@...]
> Sent: Friday, August 09, 2002 9:30 AM
> To: IBObjects@yahoogroups.com
> Subject: [IBO] Re: Many dblookup combo
>
>
> 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
>
> --- 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
>
>
> ------------------------ Yahoo! Groups Sponsor
> ---------------------~-->
> 4 DVDs Free +s&p Join Now
> http://us.click.yahoo.com/pt6YBB/NXiEAA/Ey.GAA/PhFolB/TM
> --------------------------------------------------------------
> -------~->
>
> ______________________________________________________________
> _____________
> IB Objects - direct, complete, custom connectivity to
> Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ______________________________________________________________
> _____________
> http://www.ibobjects.com - your IBO community resource for
> Tech Info papers,
> keyword-searchable FAQ, community code contributions and more
> !
>
> Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
>
>