Search code examples
delphialignmentsplitter

Delphi: align and visibility of splitter


There is a tree view, an align is left. And there is a splitter, the same, an align is left. The tree view is the first, the slitter is the second.

If to do:

TreeView1.Visible:=false;
Splitter1.Visible:=false;

And then:

TreeView1.Visible:=true;
Splitter1.Visible:=true;

The splitter will be the first from the left. Must be the second. How to prevent this?

Thanks!!!


Solution

  • AFAIK there is no way to prevent this happening (even when you change the order of making them visible again, sometimes they still end up in wrong way). Add

    Splitter1.Left := Treeview1.Left + Treeview1.Width;
    

    after making them visible again, this should move splitter back into right position.