Link to home
Start Free TrialLog in
Avatar of cydo
cydo

asked on

Memo/Richedit - How to define own Tabstop-lengths?

How can I define the length of each Tabstop
in a TRichedit?
The predefined Tabstops are to wide for my application,
so i would like to decrease them.
Example:


Example Line
________Here we´re at 1st tab________ Here we 2nd tab

but i want to have something like

Example Line
___Here we´re at 1st tab___Here we 2nd tab

Thanks!
Avatar of cydo
cydo

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of ronit051397
ronit051397

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cydo

ASKER

This is the complete example for the
setTAB procedure (done with the help of ronit´s answer):

var FFormat: TParaformat;

begin
 with FFormat do
  begin
   FillChar(FFormat, SizeOf(TParaFormat), 0);
   cbSize := SizeOf(TParaFormat);
   cTabCount:=4;
   rgxTabs[0]:=5;
   rgxTabs[1]:=15;
   rgxTabs[2]:=25;
   rgxTabs[3]:=40;
 end;
 Richedit1.Perform(EM_SETPARAFORMAT,0,LPARAM(@FFormat));
end;

but anyway, with the help of ronit´s EM_SETPARAFORMAT
i found that this setTab procedure is already wrapped into
delphi. So here´s an easier solution ;)

 Richedit1.SelectALL; {* Select all paragraphs *}

 RichEdit1.Paragraph.tab[0]:=5;
 RichEdit1.Paragraph.tab[1]:=15;
 RichEdit1.Paragraph.tab[2]:=25;
 RichEdit1.Paragraph.tab[3]:=35;
 RichEdit1.Paragraph.tab[4]:=45;

 RichEdit1.Sellength:=0; {* deselect *}

The .tab property calls (if written) the SetTab proc of
TParaAttributes, which does nearly the same as the above procedure ;)

Thanks for your help Ronit!