[SOLVED] Focus rectangle lazarus / 31-LCL ---------------------------------------------------------------------- pcurtis · 2021-11-11 06:41 How do I stop the focus box appearing round a progressbar? See attachment. ---------------------------------------------------------------------- jamie · 2021-11-13 13:43 I can not see that focus rectangle here with the Trunk nor the old 2.0.4 I still use. Unless you have been doing some direct API calls. ---------------------------------------------------------------------- wp · 2021-11-13 15:08 Trunk, Win 11: The focus rect appears when the TrackBar is focussed and an arrow key is pressed. I think it is correct this way because the focus rect signals which control will get the key presses. Anyway, I found this in a Delphi forum (https://www.delphipraxis.net/179537-trackbar-gestrichelte-linie- abschalten-anderes-design-fuer-trackbar-2.html): Set the form's ActiveControl to nil when the Trackbar receives focus: 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 TForm1.TrackBar1Enter(Sender: TObject);begin  ActiveControl := nil;end; But be aware that you can only operate the slider now with the mouse, keys are blocked. ---------------------------------------------------------------------- zeljko · 2021-11-13 19:47 Trackbar1.ControlStyle := Trackbar1.ControlStyle + [csNoFocus] ? ---------------------------------------------------------------------- pcurtis · 2021-11-14 12:57 @wp's solution works for me. Thanks all. ---------------------------------------------------------------------- jamie · 2021-11-14 13:43 yeah but, use your keys and it comes back. it seems when the OS directs key input to the control it wants to keep it focus. ---------------------------------------------------------------------- jamie · 2021-11-14 14:38 Try this.. 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 unit Unit1; {$mode objfpc}{$H+} interface uses  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ComCtrls, Lmessages,lclIntf,  StdCtrls; type  TTrackBar = Class(ComCtrls.TTrackBar)    Procedure LatePaint(var msg:TLMPaint)message LM_User+1;    procedure WMPaint(var msg:TLMPaint) Message LM_Paint;  end;   { TForm1 }   TForm1 = class(TForm)    Button1: TButton;    TrackBar1: TTrackBar;  private   public   end; var  Form1: TForm1; implementation {$R *.lfm} Procedure TTrackBar.LatePaint(var msg:TLMPaint);VarC :TControlCanvas;beginC := TControlCanvas.Create;C.Control := self;C.Brush.Style := bsClear;C.Pen.Color := Self.Brush.color;C.Rectangle(ClientRect);C.Free;End;procedure TTrackBar.WMPaint(var msg:TLMPaint);var  C:TcontrolCanvas; Begin   Inherited;   PostMessage(Handle, LM_USER+1,0,0); end; end.  it overdarws it before it's seen here.