Ver Mensaje Individual
  #2  
Antiguo 25-08-2010
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 gaston.

Primero tengo que apuntar un error en el código y creo que no es de copiado, si no de 'fabrica' por que lo he visto igual en dos o tres lados.

La línea:
Código Delphi [-]
 lblMarquee.Caption:= Copy(txt, length(txt) -1, 1) + Copy(txt, 1, length(txt) -1);
Tendría que poner el último caracter al principio y agregarle el resto -1, pero pone el anteúltimo y le agrega el resto -1.

Debería ser:
Código Delphi [-]
 lblMarquee.Caption:= Copy(txt, length(txt), 1) + Copy(txt, 1, length(txt) -1);

Ahora con lo del sonido, se me ocurre algo así: (Reduje el código para simplificar, pero es completamente funcional en ambos sentidos)
Código Delphi [-]
unit Unit1;

interface

uses
  Windows, SysUtils, Forms, ExtCtrls, Classes;

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    FCaption: string;
  public
  end;

var
  Form1: TForm1;

implementation {$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
  Caption:= 'prueba1234';
  FCaption:= Caption;
  Timer1.Interval := 1000 div 5;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  txt: string;
begin
  txt:= Self.Caption;
  Caption:= Copy(txt, length(txt), 1) + Copy(txt, 1, length(txt) -1);
  // ó,  Caption:= Copy(txt, 2, length(txt)-1) + Copy(txt,1,1);
  // si FCaption = Caption , implica que el último o primer caracter llegaron a su lugar
  if FCaption = Caption then
    Windows.MessageBeep(MB_ICONEXCLAMATION);
end;

end.


Saludos.

Última edición por ecfisa fecha: 25-08-2010 a las 09:35:13.
Responder Con Cita