Search code examples
delphidelphi-2009splitter

How to create splitter containing components?


I'd like to put some buttons between two resizable panels or directly on the splitter if possible. How do I achieve they will move along with the splitter; how do I anchor them ?

screenshot

Edit:
Maybe the most important thing I forgot to mention. That splitter has to be as wide as on the screenshot, and the buttons should lay on it; so those buttons are actually "floating over splitter" now.

Thanks a lot


Solution

  • Yo can't do it automatically.
    Manually you can change the Left property of Buttons in OnMoved event of the splitter.
    There's not a good solution (visualization on drag moment it's not good), but it can do the result that you need. You can solve this, try ResizeStyle=rsUpdate; With this when you drag the splitter the buttons move too.

    procedure TForm1.Splitter1Moved(Sender: TObject);
    begin
      SpeedButton1.Left := Splitter1.Left + 40;
      SpeedButton2.Left := Splitter1.Left + 40;
      SpeedButton3.Left := Splitter1.Left + 40;
      SpeedButton4.Left := Splitter1.Left + 40;
    end;
    

    Here you can view the result.

    Regards