Please help with TScrollBox and its VertScrollBar lazarus / 31-LCL ---------------------------------------------------------------------- haiti meid · 2011-08-15 02:33 I use this code to add control to scroll box: Code: [Select]procedure TForm1.Button17Click(Sender: TObject); var   pn: TPanel;   i, atop: integer; begin   atop:=0;   for i := 0 to ScrollBox1.ControlCount - 1 do     Inc(atop, ScrollBox1.Controls[i].Height + 3);   pn := TPanel.Create(ScrollBox1);   pn.Parent := ScrollBox1;   pn.top := atop;   pn.left := 0;   pn.width := ScrollBox1.width - 3;   pn.Anchors := [aktop, akLeft, akRight]; end; But the scroll box's vertical scrollbar does not work. If I don't use the last command: Code: [Select]pn.Anchors := [aktop, akLeft, akRight];, the code runs fine. Could you please help me? Thanks, Haiti ---------------------------------------------------------------------- Blaazen · 2011-08-15 10:15 It seems work here but note that you posted only a snippet of code. There are some advanced settings: http://wiki.lazarus.freepascal.org/Anchor_Sides I also see dozen issues about TScrollBox from 2011, so maybe you can try newer version of Lazarus. ---------------------------------------------------------------------- Arbee · 2011-08-15 10:16 May I ask what the purpose of having these anchors is?  Is working without them cause you any other problem? ---------------------------------------------------------------------- haiti meid · 2011-08-15 22:44 Thanks Blaazen, I have reviewed the link you gave me. But I was not lucky...  :-( @Arbee: I have a scroll box of questions. Every sub-panel is a question. The scroll box's alignment is alClient. - If I set each panel's alignment to alTop, the scroll box always shows horizontal scroll bar. - I want to set panel's anchors to [akLeft, akTop, akRight], with a padding: Code: [Select]pn.width := ScrollBox1.width - 3;. Then the scroll box does not show horizontal scroll bar. But it also does not show the vertical one  :-( I solved this by using event OnResize of the scroll box: whenever it resizes, I count all sub panels and re-arrange their order/ position... ---------------------------------------------------------------------- Bandbaz · 2011-09-17 22:11 I think this is a bug I have the same problem on 9.30 My program was working fine on 9.28 but when I upgraded to 9.30 I have problems with scrolls. even during form designing: start a new project add a scrollbox add a button in the scrollbox if you move the button out, you can see the scrolls. (as it is suppose to be!) now change the anchors of the button. move it again. no scroll comes! other experiences? should I report it? I'm using lazarus 0.9.30 on ubuntu 11.4 amd64 ---------------------------------------------------------------------- Bandbaz · 2011-09-18 17:36 reported: http://bugs.freepascal.org/view.php?id=20289