Redraw issues, how to optimize the code? lazarus / 21-General ---------------------------------------------------------------------- bobby100 · 2022-07-02 08:11 I am using Eye candy controls for user interface. To display the current state of the sliders at moving the slider, I use a TPanel (pnHint) with a TLabel (lbHint) on it (see screenshot, the cursor isn't shown in the capture, but I was at moving the slider as the capture is done). Both TPanel and TLabel are set to Autosize. When TLabel is set to Visible := False, the TPanel isn't visible. Here is the code that displays the label: 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 procedure TfrmMain.slSliderChange(Sender: TObject);var  pt: TPoint;  ctrl: TControl;begin  pt := ScreenToClient(Mouse.CursorPos);  lbHint.Caption := IntToStr(trunc(TECSlider(Sender).Position));  ctrl := ControlAtPos(pt, [capfRecursive, capfAllowWinControls]);    if Assigned(ctrl) then    begin        pnHint.Left := ctrl.Left + ctrl.Width - lbHint.Width    end    else        pnHint.Left := pt.Y;  pnHint.Top := pt.Y;  //pnHint.BringToFront;  lbHint.Visible := True;end; procedure TfrmMain.slSliderMouseUp(Sender: TObject; Button: TMouseButton;  Shift: TShiftState; X, Y: Integer);begin  lbHint.Visible := False;end; As it can be seen, the panel and label follows the cursor (which is nice), but if the slider is moved too fast - there are redrawing artifacts (ghosts). Any advices what can be optimized here? Using Hints from the controls isn't a solution. ---------------------------------------------------------------------- dje · 2022-07-02 11:02 I tried your setup/code using 4 TTrackBar's on a Raspberry Pi, and saw no "ghosting", so Im guessing the issue is with the extra rendering Eye Candy uses. Have you tried calling slSlider.Update or slSlider.Paint?  Or, sometimes Application.ProcessMessages works. As a fallback solution. Does the hint really need to move with the mouse? I've seen similar interfaces with static hint popup. ---------------------------------------------------------------------- bobby100 · 2022-07-02 11:37 Thanks for taking a look derek.john.evans The whole interface is a bit slow at rendering because of 102 sliders on the screen, nested in TPanels, further nested in TabSheets https://github.com/BobanSpasic/MiniDexedLibrarian - there is a Win64 executable in Bin directory if you want to take a look. Just the first slider on the Performance Edit tab, Reverb Size, has the Hint code. The hint does not really need to move with the cursor. That was simply the easiest way to bring the hint label close to the currently moving slider. I'll try to fixate the position somewhere on the current slider. No 'ghosting' but I suppose it will need more calculation of the coordinates.