How to use two TSplitter with different aligns (Horizontal and Vertical)?
Asked Answered
T

2

10

I have a form with three sections, and I want to allow the users to resize them as they please

There is one section on the left (which take the whole height) and one on the right that is again cut in two vertically. See below:

11|22
11|---
11|33

Using one splitter is quite easy:

Component1.align := alLeft
Splitter1.align := alLeft
Component2.align := alClient

Now, starting with that I have absolutely no idea how to get a vertical splitter working. If I set my second splitter to alTop or alBottom, it does all the way to the top/bottom and not only in the right half.

I manage to get something like this:

11111
--------
22||33

By creating the vertical split first, and then the horizontal one, but that doesn't work the other way.

One possible solution is to use a panel as my right side and then use a splitter INSIDE this pannel for vertical splitting but it doesn't really feels like the right way.

Thanks

Tipsy answered 7/6, 2009 at 18:40 Comment(0)
S
19

The extra Panel is the right way. Trying to have 2 Splitters inside one ClientArea is just overtaxing the Alignment system. Besides, the cost of an extra TPanel is very low.

Singlebreasted answered 7/6, 2009 at 18:49 Comment(4)
Yes when you need anything complex with splitters, Tpanel's are the way to goRuebenrueda
You can also easily set the BevelOuter to bvNone and the panel no will no longer have a border.Miso
Just curious, why Tpanel and not TGroupbox?Sulph
A GroupBox is a TPanel with a header. If you don't need/want the header ...Singlebreasted
M
1

Place 2 controls. For example 2 richedit: - Put both the controls over the same panel. - the left one with property 'align' to 'aleft' - the right one with property 'align' to 'alclient' !!! - then place the splitter in-between. - the splitter is aligned to alLeft.

For a horizontal splitter change splitter align property to 'altop'.

Mycostatin answered 7/6, 2009 at 18:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.