TCheckGroup slow to update items lazarus / 31-LCL ---------------------------------------------------------------------- dbannon · 2023-04-16 02:56 I am using TCheckGroup and update its items property at runtime. At present, all I add is five strings of 10 to 15 char each. And, to my surprise I find it takes about 13mS to 15mS each time. No matter how I put the data into the TCheckGroup (in these attempts shown here, Ex.CatList is TStringList )- Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i CheckGroupCategory.Items := Ex.CatList;    CheckGroupCategory.Items.As sign(Ex.CatList);CheckGroupCategory.Items.Text := Ex.CatList.Text;for i := 0 to Ex.CatList.Count-1 do        CheckGroupCategory.Items.add(Ex.CatList[i]); Just to demo that the problem is with TCheckGroup, this snippit takes less that 1mS - Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     STL := TStringList.Create;    for i := 0 to Ex.CatList.Count-1 do        STL.Add(Ex.CatList[i]);                         So, I have to assume that the problem is with TCheckGroup, probably slow doing screen updates while data is changing (although I would expect using text property would avoid that).  But TCheckGroup does not appear to have a .BeginUpdate capability? What have I missed ? Davo ---------------------------------------------------------------------- wp · 2023-04-16 10:00 The problem is that with each item added the position of the checkbox must be recalculated. Using CheckGroup.Disable/EnableAutoSizing allows me to add 100 items in less that 100 ms. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   checkGroup.DisableAutoSizing;  try    checkGroup.Items.Text := s;  finally    checkGroup.EnableAutoSizing;  end; ---------------------------------------------------------------------- dbannon · 2023-04-16 10:40 Ah, thanks WP, that makes sense. Sadley, I have just posted my patch to https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40190 but I am quite sure it will need some revisions. Davo ---------------------------------------------------------------------- jamie · 2023-04-16 13:05 items.BeginUpdate.... Items.EndUpdate don't work for you? ---------------------------------------------------------------------- dbannon · 2023-04-17 05:13 Yes, Jamie, you are quite correct, items.beginUpdate; does not work for me. The time consuming effort is in the TCheckGroup where its adding a component for each string added. Locking the TStrings is insignificant.  I still see 14mS for adding five items. Using WP's suggestion, the time comes down to 6mS, still more than I'd expect if TCheckGroup had its own BeginUpdate but much better than 14mS. Davo