Ver Mensaje Individual
  #3  
Antiguo 20-06-2015
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
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;
//-------------------------------------------------------------

// Comenzar la escritura en el memo
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
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita