TSplitter problem

Posted on 2007-11-16
Last Modified: 2008-02-26

Can anyone give me an example how to create a form with 1 TPanel, 3 TMemo and 2 TSplitter?

Those components (TPanel, TMemo, TSplitter) must be created during runtime.

The TPanel must be aligned to the whole form (alClient) and the 3 TMemo are separated by those 2 TSplitter.

Question by:klompen
  • 2
LVL 19

Accepted Solution

MerijnB earned 125 total points
ID: 20296898
try this:
procedure TForm1.FormCreate(Sender: TObject);
var Memo1, Memo2: TMemo;
    Panel: TPanel;
    Splitter1, Splitter2: TSplitter;
 Splitter1 := TSplitter.Create(Self);
 Splitter1.Align := alLeft;
 Splitter1.Parent := Self;
 Memo1 := TMemo.Create(Self);
 Memo1.Align := alLeft;
 Memo1.Parent := Self;
 Memo1.Lines.Text := 'memo1';
 Panel := TPanel.Create(Self);
 Panel.Align := alClient;
 Panel.Parent := Self;
 Panel.Caption := 'panel';
 Memo2 := TMemo.Create(Self);
 Memo2.Align := alRight;
 Memo2.Parent := Self;
 Memo2.Lines.Text := 'memo2';
 Splitter2 := TSplitter.Create(Self);
 Splitter2.Align := alRight;
 Splitter2.Parent := Self;

Open in new window

LVL 19

Expert Comment

ID: 20296900
I don't know where you want to place the 3th TMemo, drop a line of you can't figure it out with this example.
LVL 11

Expert Comment

ID: 20304206
What about this?

P.S. TPanel has align alTop instead of alClient in this example...
procedure TForm1.FormCreate(Sender: TObject);
    obj : TControl;
obj := TPanel.Create(self);
obj.Align := alTop;
obj.Parent := self;
TPanel(obj).Caption := 'panel';
TPanel(obj).Height := ClientHeight - 200; // leave 200px for TMemos
// 1st and 2nd memo; they will be added in reverse order, i.e., if we append TSplitter and then TMemo,
// TMemo will be added *before* TSplitter, therefore I start with 2nd TSplitter, then add 2nd memo, then
// 1st splitter, then 1st memo
obj := TSplitter.Create(self);
obj.Align := alLeft;
obj.Parent := self;
obj := TMemo.Create(self);
obj.Align := alLeft;
obj.Parent := Self;
TMemo(obj).Text := 'memo 2';
obj := TSplitter.Create(self);
obj.Align := alLeft;
obj.Parent := self;
obj := TMemo.Create(self);
obj.Align := alLeft;
obj.Parent := Self;
TMemo(obj).Text := 'memo 1';
// 3rd memo - alClient - takes the free space; doesn't have to be added before 1st and 2nd memo's
// because this is not alLeft
obj := TMemo.Create(self);
obj.Align := alClient;
obj.Parent := Self;
TMemo(obj).Text := 'memo 3';

Open in new window


Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question