I'm new to using component TControlList
. Can someone help with this.
How exactly can a selected field or item from the TControlList
be deleted for example?
I'm filling the items to TControlList
from SQLLite
database like this:
procedure TForm1.ControlList1BeforeDrawItem(AIndex: Integer; ACanvas: TCanvas;
ARect: TRect; AState: TOwnerDrawState);
begin
dm.fdmedcin.RecNo := AIndex+1;
lbl5.Caption := 'Spc:' +TStringField( dm.fdmedcin.FieldByName('Spc_doc') ).AsString ;
.........
procedure TDM.fdmedcinAfterOpen(DataSet: TDataSet);
begin
form1.ControlList1.ItemCount := fdmedcin.RecordCount;
You get the selected item with
TControlList.ItemIndex
.One solution could be that you create a method that deletes the entry in your
fdmedcin
and re-set theTControlList.ItemCount
again like in your example.I don't know your exact code but it could look like this:
In other words: you have to match the
TControlList.ItemIndex
with your DataSet/whatever index.I made a simple example with a
TList<T>
whileT
is aninteger
: