Behaviour of Scrollbars in TScrollbox for AutoScroll:= False; lazarus / 31-LCL ---------------------------------------------------------------------- kupferstecher · 2016-05-25 20:25 There are some cases where I would like to have a TScrollbox with only a vertical scrollbar and this scrollbar should be always there, even if there is nothing to scroll (representation like a disabled TScrollbar). In TMemo and TStringGrid this behaviour can be achieved by setting ScrollBars:= ssVertical. It seems it is not possible to do this with TScrollbox. If I set AutoScroll to false then the existence of Scrollbars depends on the fact if scrolling was needed while design time (Controls placed inside need more space). For me a strange behaviour. I would expect the existence of the scrollbars only (user)defined by HorzScrollBar.Visible and VertScrollBar.Visible. Do I miss something? Is there a further setting to accomplish such a behaviour? Or is it just not possible with TScrollbox? Why I need it: When the Scrollbars are dynamically shown and hidden, then the Clientwidth changes accordingly, which might require replacement of child controls. In some cases this is very nasty for both me as programmer and in a visual way for the user. Thanks for Your Help! System: Win7/64 Lazarus 1.6 FPC 3.0.0 ---------------------------------------------------------------------- kupferstecher · 2016-05-28 17:27 I still don't know if its possible to use the TScrollbox in my intended way. But I found a workaround by placing a dummy TScrollbar (enabled:=false) on the correct possition and setting it to visible when autoscroll hides the scrollbar. This is determined by comparing the logical size with the client size: 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 LogRect:= GetLogicalClientRect;if LogRect.Bottom > Clientheight  then DummyScrollbar.Visible:= false  else DummyScrollbar.Visible:= true; If the width is not set in the beginning it will have the standard width which is the same as in the tScrollbox (behaviour tested with Win7). ---------------------------------------------------------------------- scribly · 2017-04-06 13:01 Is there really no other solution than using a dummy scrollbar ? ---------------------------------------------------------------------- ASerge · 2017-04-06 16:48 If you really want 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  TAlwaysVisibleControlScrollBar = class(TControlScrollBar)  protected  function ScrollBarShouldBeVisible: Boolean; override;  end; function TAlwaysVisibleControlScrollBar.ScrollBarShouldBeVisible: Boolean;begin  Result := Visible;end; procedure ChangeClassForInstance(Instance: TObject; NewClass: TClass);begin  TClass(Pointer(Instance)^) := NewClass;end; procedure TForm1.FormCreate(Sender: TObject);begin  ChangeClassForInstance(ScrollBox1.VertScrollBar, TAlwaysVisibleControlScrollBar);end; ---------------------------------------------------------------------- scribly · 2017-04-06 20:45 interesting. thanks