You aren't going to like this!
Is your database Client Server??? or local. If Cs, then you SHOULD_NOT_USE
this control. It is very inneficient. In general (even for local database)
you are better to manuallt populate a standard TCombo - you can use the
TStrings.Objects to store the ID, and the items to store the display . Then
you can use the TCombo OnChange handler to do what you want.

Off the top of my head the code goes something like:=

Consider a lookup table from which you wish to populate a combo...

procedure PopulateLabelCombo(Combo: TComboBox; DefaultLabelID: Integer; All,
None: Boolean);
begin
 Combo.Items.Clear;
 with TQuery.Create(nil) do begin
  DatabaseName := GlobalDatabaseName;
  SQL.Add('Select LabelID, PFMTCode || " " || LabelName LabelName from Label
Order By PFMTCode');
  Open;
  if All then
   Combo.Items.Add('[All]');
  if None then
   Combo.Items.Add('');
  while not EOF do begin
   Combo.Items.AddObject(FieldByName('LabelName').AsString,
TObject(FieldByName('LabelID').AsInteger));
   Next;
  end;
  Free;
 end;
 SelectComboDefault(Combo, DefaultLabelID);
end;

TO get stuff back out of the Combo, use the Objects  like this...

var
    LabelID: Integer;
begin
    LabelID := Integer(cbLabel.Items.Objects[cbEventType.ItemIndex])



;

-----Original Message-----
From: Eion McIntosh (CHCH) <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Tuesday, 30 November 1999 9:42 AM
Subject: [DUG]: TDBLookupCombobox


>I have a form with 3 TDBLookupcomboboxes on it.
>On changing one, the next ones entries change accordingly and then the
>next one.
>
>This works fine as the data changes as required and is saved to the
>table, but when I am scrolling through one at a time, navigating, the
>combo boxes entries change as they are supposed to but the physical
>value in the database field does not always redisplay on the screen.
>Sometimes is does, sometimes it doesn't.
>
>If you click on box to see the available entries, the list is correct
>and the current item is highlighted but it just doesn't display in the
>combobox itself.
>
>I have tried calling the refresh and update methods but it makes no
>difference.
>
>Any ideas please.
>
>Eion McIntosh
>---------------------------------------------------------------------------
>    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                  Website: http://www.delphi.org.nz

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to