The gateway page to the examples is here and the examples are even available on sourceforge so you can check them out using your favourite svn client. procedure TForm1.FormCreate(Sender: TObject) įor all that the Delphi documentation is much maligned, it often has very useful examples like this. The Delphi documentation contains this example that does exactly what you want. ListItem.Caption:= 'Full name: '+Fullname.AsString One thing I'm trying to do is to load a field of all records from a TFDMemtable component into a Listview Item, specifically into the DetailObject of the ListView Item. SQLQuery1.DisableControls //Disable UI updating until where done. SQLQuery1.First // move to the first record Never use `FieldByName` inside a loop, it's slow.įullName:= SQLQuery1.FieldByName('fullname') Ĭountry:= SQLQuery1.FieldByName('cntry') You must use OnDrawItem to remove the space before your item and when you ae drawing the item with the -1 ImageIndex use Canvas.TextRect (Rect,Rect.Left+1,Rect. SQLQuery1.ParamByName('age').AsInteger:= age := 'SELECT * FROM users where user_age= :age' I'm not sure how to get the listview to multiline, but I do know you're not using the Query correctly.Īs it stands your code has an SQL-injection hole and the implicit reference to 'fieldbyname' inside the loop makes it slow.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |