Link to home
Start Free TrialLog in
Avatar of dabestprogrammerindauniverse
dabestprogrammerindauniverse

asked on

TAB!

how do u put a tab characted in a memo?  i want to align my data so i want to display them in between tabs...how do i do this???

tnx!!!
ASKER CERTIFIED SOLUTION
Avatar of TOndrej
TOndrej

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 kretzschmar
memo1.lines.add('Before tab'+#9+'after Tab');
Avatar of f15iaf
f15iaf

This may help:
The program put 9 spaces when user clicks tab button:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    Timer1: TTimer;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
        if(form1.activecontrol=memo1)then
        begin
                if(getkeystate(VK_TAB)<0)then
                memo1.SelText:='        ';
        end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
        timeout:dword;
begin
        systemparametersinfo(spi_getkeyboardspeed,0,@timeout,0);
        timer1.Interval:=timeout;
end;

end.
Why not using RichEdit instead ?
Than you can set your own tabs like this :

  With RichEdit1.Paragraph do
  begin
    Tab[0] := 90;
    Tab[1] := 150;
    Tab[2] := 200;
    Tab[3] := 250;
  end;


Be sure that WantTabs-property is set to True.