[Lazarus] DBGrid picklist error

Denis Golovan d.golovan.ml at gmail.com
Fri Jul 4 17:18:08 CEST 2008


On Thu, Jul 03, 2008 at 06:56:54PM -0400, Bob K. wrote:
> Denis,
> 
> I'm having the same problem with RxDBGrid.  Are you not having this problem?
> 
> bob k.
> 

Use KeyList/PickList properties, and fill them on form show (or create).
Something like the following^

procedure TfrmOrderGoods.DealerPickListFill;
var SQL:TSqlite3Dataset;
    C:TRxColumn;
begin
  C:=grdBusket.ColumnByFieldName('Dealer');
  C.KeyList.Clear;
  C.PickList.Clear;

  SQL:=nil;
  try
    SQL:=BaseConnect.DatasetCreate('select d.id, d.Name from Dealers d order by d.Name');
    while not SQL.EOF do
      begin
	C.KeyList.Add( SQL.FieldByName('id').AsString );
	C.PickList.Add( SQL.FieldByName('Name').AsString );
	SQL.Next;
      end;
  finally
     SQL.Free;
 end;
end;

-- 
Best regards,
Denis Golovan aka MageSlayer



More information about the Lazarus mailing list