Recent

Author Topic: DBGrid PickList ItemIndex Problem  (Read 6986 times)

piper62

  • New Member
  • *
  • Posts: 41
DBGrid PickList ItemIndex Problem
« on: May 08, 2008, 11:25:34 pm »
Hi,

I fill a picklist in a DBGrid with some entries and add to each entry an integer number whic represents the key for this value in the database table.

Filling the picklist:
procedure TForm1.FormShow(Sender: TObject);
begin
     ZReadOnlyQuery1.SQL.Clear;
     ZReadOnlyQuery1.SQL.Add('select * from language');
     ZReadOnlyQuery1.Open;
     while not ZReadOnlyQuery1.EOF do
     begin
DBGrid1.Columns.Items[2].PickList.AddObject(ZReadOnlyQuery1.FieldByName('languageName').asString,TObject(ZReadOnlyQuery1.FieldByName('language_id').AsInteger));
        ZReadOnlyQuery1.Next;
     end; { of while }
end

To fill the PickList is no problem but I can't access the DBGrid1.Columns.PickList.ItemIndex

I need it to access my key value what I have to write into the database table.

My System is FCP 2.0.4, Lazarus 0.9.22 and GTK1.2 with Debian Etch and KDE 3.5.5.

Can somebody please give me an advise? It makes me mad!

Regards,
Tibor

piper62

  • New Member
  • *
  • Posts: 41
DBGrid PickList ItemIndex Problem
« Reply #1 on: June 10, 2008, 04:22:26 pm »
Update:

Tested the Picklist.ItemIndex problem also on FPC 2.2, Lazarus 0.9.24.

Same problem! There's no way to access the ItemIndex of the picklist.

Has somebody a solution?

Regards,
Tibor

 

TinyPortal © 2005-2018