[solved] unable to change a Splitter location programmatically lazarus / 31-LCL ---------------------------------------------------------------------- indydev · 2025-04-24 01:40 I can't seem to set/change a splitter's location in code. I have a splitter between a Scrollbox and a Listview control inside a Panel.  The splitter properly adjusts with user input, but if I try to set the position (after loading content in the scrollbox) in code, it doesn't move. I have tried setting the Splitter.Top value, and using the Splitter.MoveSplitter(offset) method. Here is the relevant code: 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.DisplaySpriteSheet;begin  if PackedBitmap = nil then  begin    SheetScrollBox.Invalidate;    Exit;  end;  SheetScrollBox.Height := min(PackedBitmap.Height + 2* bgBorderSize, Screen.Height - 185);  Splitter1.Top := SheetScrollBox.Height + 1;  //Splitter1.MoveSplitter(Splitter1.Top - SheetScrollBox.Height + 1);  Panel2.Invalidate;end; I have tried various anchor and align value combinations to see if that played a role, but so far no dice. Maybe it can't be done? ---------------------------------------------------------------------- Hansvb · 2025-04-24 07:08 Hi, Not sure if this is what you mean but in the attached example you can slide the splitter using code. Take a good look at the anchor editor of the listview. if you only need 1 splitter you can also look at the TPairSplitter ---------------------------------------------------------------------- indydev · 2025-04-24 14:48 Thanks. The splitter definitely moves when you click each button, but on my system, the drag function of the splitter doesn't work.  I don't understand why either of these work the way they do (code moves, but doesn't drag in yours. mine drags, but doesn't move using code). I have to get to a meeting, so I will have to look more closely when I have some time. I only looked at the first program. There's a second one you included, but will have to look at it later. ---------------------------------------------------------------------- Ally · 2025-04-24 15:24 Hello indydev, Here is another example that only requires a few lines of program code. Most of the work is done with the anchor editor. Greetings Roland ---------------------------------------------------------------------- indydev · 2025-04-24 18:43 Ok, Thanks for these examples.  My problem isn't solved, but I know it isn't the code not being able to move the splitter. I threw on a button to my form it moves the slider using code. This probably has to do with the splitter not updating/painting etc.  For now I just have a button to handle it manually. ---------------------------------------------------------------------- indydev · 2025-04-24 18:54 Problem Solved.  Instead of trying to resize the SheetScrollBox, I just needed to move the Splitter1.Top directly. Thanks for everyone's advice and patience with me.