Search code examples
delphiuser-interfacesplitter

Why is my TSplitter in the wrong place?


I've got a dialog that's laid out something like this:

---------------------------------------------
|                                           |
| CONFIG AREA                               |
| Align: alTop                              |
--------------------------------------------- <-static boundary
|                                           |
| DISPLAY AREA 1                            |
| Align: alTop                              |
============================================= <-TSplitter Align: alTop
|                                           |
| DISPLAY AREA 2                            |
| align: alClient                           |
--------------------------------------------- <-bottom of dialog

However, at runtime, the splitter doesn't show up between Display Area 1 and Display Area 2, but between Config Area and Display Area 1, leading to some annoying interface problems. There's nothing in the form's setup-related event handlers that alters the Visible or Align properties of any of these components. Does anyone know why the splitter isn't loading in the place it's positioned at in the form designer?


Solution

  • (Can't reproduce.) Splitters are tricky things. I always write code to position them. In this case, I would do

    procedure Form1Show(Sender: TObject);
    begin
      Splitter1.Top := DisplayArea2.Top;
    end;