[Lazarus] DBLookupComboBox anomaly

Gabor Boros gaborboros at yahoo.com
Mon Jul 20 21:14:40 CEST 2015


Hi,

On Windows a DBLookupComboBox not show any value before explicitly set 
KeyValue to not null value or select value at runtime. This is correct. 
On Kubuntu 14.04 64bit+Qt, if open the DataSet(query) or add a record to 
an empty DataSet in FormShow the first record showed in 
DBLookupComboBox, see the example below. But if do open/append in 
FormCreate works like with Windows, no value selected automatically. Why 
a value selected automatically if call open/append in FormShow? I use 
fixes_1_4(49527) with fixes_3_0(31206).

procedure TForm1.FormCreate(Sender: TObject);
begin
   BDS:=TBufDataset.Create(Self);
   BDS.FieldDefs.Add('ID',ftInteger);
   BDS.FieldDefs.Add('NAME',ftString,10);

   dsBDS:=TDataSource.Create(Self);
   dsBDS.DataSet:=BDS;

   DBLookupComboBox1.Style:=csDropDownList;
   DBLookupComboBox1.ListSource:=dsBDS;
   DBLookupComboBox1.ListField:='NAME';
   DBLookupComboBox1.KeyField:='ID';

   BDS.CreateDataset;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
   BDS.AppendRecord([1,'aaa']);
end;

Gabor




More information about the Lazarus mailing list