Link to home
Start Free TrialLog in
Avatar of klompen
klompen

asked on

TSplitter problem

Hi,

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.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of MerijnB
MerijnB
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
What about this?

P.S. TPanel has align alTop instead of alClient in this example...
procedure TForm1.FormCreate(Sender: TObject);
var
    obj : TControl;
begin
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';
end;

Open in new window