RichMemo/Samples

Tabs

edit

Tabs are used to organize the text in table-like layout. This would not be a real layout table, but will make the text (if it's short enough) to look table alike.

Basics

edit

In order for tabs to work the text should be split tab character (#9)

This is how the text would look like if no tab separation is used:

  RichMemo1.Lines.Add('hello world'); 
  RichMemo1.Lines.Add('this sample');

If the words are split by Tabs, then the control tries to find the next proper tab offset in order:

  RichMemo1.Lines.Add('hello'#9'world'); 
  RichMemo1.Lines.Add('this'+#9+'sample');

Tab Offsets

edit

The length of tab offsets can be controlled using GetParaTabs and SetParaTabs methods.

var
  st : TTabStopList;
  i  : integer;
begin
 
  RichMemo1.GetParaTabs(0, st); // getting the current tabs
  st.Count:=8;
  SetLength(st.Tabs, st.Count);
  for i:=0 to length(st.Tabs)-1 do
    st.Tabs[i].Offset:=i*72;
  RichMemo1.SetParaTabs(-1,-1,st); // assigning tabs stops
 
  // assigning text with tabs (#9)
  RichMemo1.Lines.Add('hello'#9'world'#9'to'#9'columns');
  RichMemo1.Lines.Add('does'#9'it'#9'look'#9'good'#9'?');
  RichMemo1.Lines.Add('tab'+#9+'is'+#9+'character'+#9+'9');
end;

See Also

edit