Search code examples
delphisplitter

Delphi: splitter resizes only 2 panes which it splits


I have 4 panels, in a row, with 3 splitters in between. 1st/2nd/3rd panes: align=alLeft, 4th pane: align=alClient.

[1] | [2] | [3] | [4]

Now user wants, that

  • splitter 1 resizes only panels 1 and 2 (don't touch others; now it moves panels 3/4)
  • splitter 2 resizes only panels 2 and 3 (don't touch others; now it moves panel 4)

How to do this, what events to handle (TSplitter.OnMoved of course) and how to handle them? Maybe don't set Align like now?


Solution

  • Assuming that Splitter 3 (last) shall only change Panel 3 and 4, this can be done with a little bit of nesting:

    1. The top level has PanelA (alLeft), Splitter3 (alLeft), Panel4 (alClient).
    2. PanelA contains PanelB (alLeft), Splitter2 (alLeft), Panel3 (alClient).
    3. PanelB contains Panel1 (alLeft), Splitter1 (alLeft), Panel2 (alClient).