Sick Series
Sick Series

Reputation: 183

Delphi - How to add tabs in TMEMO?

As shown like here.

pic: tabs with memo

Currently, my TMEMO displays bunch of different data, like this:

Data #1 Paragraphs

Data #2 Paragraphs

Data #N Paragraphs

So to avoid scrolling, I want to add tabs to the Nth number.

So what components do I need and how should I intiate the process?

Upvotes: 0

Views: 3244

Answers (3)

Danny Rancher
Danny Rancher

Reputation: 2005

Use TPageControl and TTabSheet. Place a TMemo component on each TTabSheet.

You can drage the TPageControl onto the form to get started.

Upvotes: 0

Agustin Seifert
Agustin Seifert

Reputation: 1968

Do not know how you get your paragraphs but you'll have to iterate through them, creating a TabSheet and a Memo for each.

procedure TfrmMemo.CreateTabsWithMemo;
var
  pgControl: TPageControl;
  TabSheet: TTabSheet;
  Memo: TMemo;
begin
  pgControl := TPageControl.Create(self);
  pgControl.Parent := Self;
  pgControl.Align := alClient;

  //Do this for each paragraph
  TabSheet := TTabSheet.Create(pgControl);
  TabSheet.PageControl := pgControl;
  TabSheet.Caption := Format('Tab %d', [pgControl.PageCount]);

  Memo := TMemo.Create(TabSheet);
  Memo.Parent := TabSheet;
  Memo.Align := alClient;

  Memo.Lines.Text := 'Your Paragraph here'
  ///
end;

Upvotes: 0

Z .
Z .

Reputation: 12837

you need to use a combination of a TMemo and TTabControl.

Upvotes: 2

Related Questions