[Solved] How to lock/unlock control repainting (to eliminate flicker)? lazarus / 31-LCL ---------------------------------------------------------------------- AlexTP · 2018-12-22 14:04 On Delphi I was able to use some WIn32 API (with word "Update"? I dont recall) which was blocking all control repainting. And then unlock too. How to do it here? I need it for CudaText, where changing grouping mode makes FLICKER: new groups (child panels) appear, old groups resize... ---------------------------------------------------------------------- jamie · 2018-12-22 14:11 Control.Invalidate; --- Also, the canvas has ClipRect;; Canvvas.ClipRect := TREct(?,?,?,?); Canvas.Clipping := true; ---- You can assign a clear brush to the background of the parent if you are going to repaint the background yourself. Also the use of ExcludeClipRect can disallow a rect to not be painted. There are many ways.. ---------------------------------------------------------------------- lucamar · 2018-12-22 16:28 I'm not really sure but, doesn't TForm's BeginFormUpdate/EndFormUpdate do what you want? ---------------------------------------------------------------------- balazsszekely · 2018-12-22 16:52 Quote from: Alextp on December 22, 2018, 03:04:48 pmOn Delphi I was able to use some WIn32 API (with word "Update"? I dont recall) which was blocking all control repainting. And then unlock too. API LockWindowUpdate? 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 LockWindowUpdate(Control.Handle);try  //...finally  LockWindowUpdate(0);end; ---------------------------------------------------------------------- AlexTP · 2018-12-23 16:55 Thanks! i used your tip and have fixed it: 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 type  TFormHack = class(TForm); procedure DoControlLock(Ctl: TWinControl);begin  if Application.MainForm<>nil then    TFormHack(Application.MainForm).BeginFormUpdate;end; procedure DoControlUnlock(Ctl: TWinControl);begin  if Application.MainForm<>nil then    TFormHack(Application.MainForm).EndFormUpdate;end; ---------------------------------------------------------------------- User137 · 2018-12-23 18:04 That's not crossplatform. Are you sure the invalidate and begin/endupdate things weren't enough? Set form doublebuffering true? ---------------------------------------------------------------------- AlexTP · 2018-12-23 19:03 Corrected the code: it is cross platform.