Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 945
Lepidosteus Avatar asked Jun 07 '09 18:06

Lepidosteus


2 Answers

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.

like image 57
Henk Holterman Avatar answered Nov 16 '22 00:11

Henk Holterman


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'.

like image 39
magarwal Avatar answered Nov 16 '22 01:11

magarwal