0

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?

Sick Series
  • 163
  • 1
  • 6
  • 14
  • 1
    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 Jan 06 '14 at 21:57

3 Answers3

2

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

Z .
  • 12,657
  • 1
  • 31
  • 56
0

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;
Agustin Seifert
  • 1,938
  • 1
  • 16
  • 29
0

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

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

Danny Rancher
  • 1,923
  • 3
  • 24
  • 43