3

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!!!

maxfax
  • 4,281
  • 12
  • 74
  • 120

2 Answers2

6

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.

ain
  • 22,394
  • 3
  • 54
  • 74
  • For other people finding this in a search, if you're doing this with right aligned controls, you need to do `Splitter1.Left := ClientWidth - Splitter1.Width - Treeview1.Width - 1` – Nat Jul 23 '11 at 14:28
  • @Nat For right aligned controls `Splitter1.Left := Treeview1.Left - 1;` should do. – ain Jul 23 '11 at 14:37
  • @ain Sorry, yep, you're right... I was over engineering there! – Nat Jul 24 '11 at 01:24
2

To make splitter second from the left you must make sure that TreeView is first on the left by setting:

TreeView1.Visible := True;
Splitter1.Visible := True;
Treeview1.Left := 0;
too
  • 3,009
  • 4
  • 37
  • 51