Use columns in a RichEdit  

Send By: Radikal (Q3 Team)
Web : http://www.q3.nu
Email: radikal@q3.nu
Date: 13/10/99

Tip accessed 624 times

 


First we define the columns that we want with a similar code to this:


   {RE1 es el RichEdit}
   {RE1 is the RichEdit}
   with Re1 do
   begin
     Paragraph.TabCount:=1; {Un Tab/one tab}
     Paragraph.Tab[0]:=100; {En la columna 100/In the row 100}
   end;



With this, we have defined a tabulator stop and I have put it in the column 100. If you want more columns... define more.
And when adding the data in columns, you should use something like that:


 Re1.Lines.Add('Primera columna'+^I+'Segunda Columna');
 Re1.Lines.Add('First Column'+^I+'Second column');



A example:

  • Put a tRichEdit (RE1 and a TButton in your form
  • Put this code in the OnClick event of the TButton


     procedure TForm1.Button1Click(Sender: TObject);
     var
        n:integer;
     begin
      with Re1 do
       begin
         Lines.Clear;
         Paragraph.TabCount:=1;
         Paragraph.Tab[0]:=100;
       end;
       for n:=1 to 10 do
         Re1.Lines.Append('Columna 1'^I'Columna 2');
     end;