Hola pokexperto1.
Un modo de hacer lo que buscas es el siguiente, (agrega un
TMemo y un
TButton a un form):
Código Delphi
[-]
...
implementation
type
TSpell = class(TThread)
private
FText : string;
FCount : Integer;
FTime : DWORD;
FInterval: Cardinal;
Memo : TMemo;
public
constructor Create; reintroduce; overload;
procedure Execute; override;
property Interval: Cardinal read FInterval write FInterval;
property Text: string read FText write FText;
end;
constructor TSpell.Create;
begin
inherited Create(True);
FTime := GetTickCount;
FCount := 0;
end;
procedure TSpell.Execute;
begin
inherited;
while FCount <= Length(FText) do
begin
if GetTickCount - FTime > Interval then
begin
Inc(FCount);
Memo.Text := Memo.Text + FText[FCount];
Application.ProcessMessages;
FTime := GetTickCount;
end;
end;
end;
procedure SpellText(const Texto: string; Memo: TMemo; const Interv: Integer);
var
spell: TSpell;
begin
spell := TSpell.Create(True);
try
spell.Memo := Memo;
spell.Text := Texto;
spell.Interval := Interv;
spell.Execute;
finally
spell.Free;
end;
end;
procedure TForm1.btnStartClick(Sender: TObject);
begin
Memo1.Clear;
SpellText('Esperar a que termine un ', Memo1, 50);
SpellText('proceso y luego continuar.', Memo1, 50);
SpellText(#13#10+'Escribir una segunda linea.', Memo1, 50);
SpellText(#13#10+'Y ahora una tercera...', Memo1, 50);
end;
Salida:
Saludos