[SOLVED]TChartListbox multiselect lazarus / 55-TAChart ---------------------------------------------------------------------- zahu · 2015-05-05 16:44 I would like to delete multiple series from a chart using selection in a chartlistbox, but if I use the code below, only the last selected serie from a multi-select ensemble is deleted. What do I wrong? Code: [Select]   for j:=-1+ChartListbox1.count downto 0 do        if Chartlistbox1.selected[j]=true then Chartlistbox1.Series[j].free Env: Lazarus 1.4 win32 version on x64 ---------------------------------------------------------------------- wp · 2015-05-05 17:14 The problem is that after the first series has been deleted the charts sends a notification message to the listbox that a series has been removed from the chart; the listbox then repopulates its series list and forgets about the other selected series. As a workaround you could save pointers to the selected series in a list, and then destroy the list items: Code: [Select]procedure TForm1.Button1Click(Sender: TObject); var   j: Integer;   list: TList; begin   list := TList.Create;   try     // temporarily store selected listbox series in a separate list     for j:=0 to ChartListbox1.Count-1 do       if ChartListbox1.Selected[j] then list.Add(ChartListbox1.Series[j]);     // destroy the series in this temporary list     for j:=list.Count-1 downto 0 do       TObject(list[j]).Free;   finally     list.Free;   end; end; ---------------------------------------------------------------------- zahu · 2015-05-05 19:17 Thank You! It worked well. ---------------------------------------------------------------------- wp · 2015-05-06 17:24 In r48942 of Laz trunk, the temporary list of my code above is included in TChartListbox. Therefore, it is no longer needed to use this workaround. Your initial code should work now.