0
votes

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?

3
If you need more than about 5 tabs, you should reconsider this type of GUI. There might be better options. Maybe you can have a listbox to the left of the memo, with an item for each paragraph? It'll be nicer to scroll through that than to scroll through many tabs.Wouter van Nifterick

3 Answers

2
votes

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

0
votes

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;
0
votes

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

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