[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

TSplitter problem

Posted on 2007-11-16
3
Medium Priority
?
1,584 Views
Last Modified: 2008-02-26
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.
0
Comment
Question by:klompen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
MerijnB earned 500 total points
ID: 20296898
try this:
procedure TForm1.FormCreate(Sender: TObject);
var Memo1, Memo2: TMemo;
    Panel: TPanel;
    Splitter1, Splitter2: TSplitter;
begin
 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;
end;

Open in new window

0
 
LVL 19

Expert Comment

by:MerijnB
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.
0
 
LVL 11

Expert Comment

by:ZhaawZ
ID: 20304206
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

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

656 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