Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #15  
Antiguo 05-08-2007
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Poder: 26
seoane Va por buen camino
Bueno, no entiendo por que intentar relacionar el TEdit con el label dentro del propio código del label, lo mas lógico seria usar el caption y el método OnChange del TEdit.

Pero el cliente siempre tiene razón
Código:
unit Blinklbl;

interface

uses
  Classes, StdCtrls, ExtCtrls;

type
  TAnimLabel = class(TLabel)
  private
    FVelocidad: integer;
    FTimer: TTimer;
    procedure SetVelocidad(Valor: Integer);
  protected
    procedure Animar(Sender: TObject);  virtual; abstract;
  public
    constructor Create(AOwner : TComponent); override;
    destructor Destroy; override;
  published
    property Velocidad: Integer read FVelocidad write SetVelocidad;
  end;

  TBlinkLabel = class(TAnimLabel)
  protected
    procedure Animar(Sender: TObject); override;
  end;

  TMarqueeLabel = class(TAnimLabel)
  private
    FEdit: TEdit;
    FIndice: Integer;
  protected
    procedure Animar(Sender: TObject); override;
  published
    property Edit: TEdit read FEdit write FEdit default nil;
  end;

procedure Register;

implementation

{ TAnimLabel }

constructor TAnimLabel.Create(AOwner : TComponent);
begin
  inherited Create(AOwner);
  FTimer := TTimer.Create(Self);
  FTimer.OnTimer:= Animar;
  FVelocidad:= 100;
  FTimer.Interval:= FVelocidad;
  FTimer.Enabled:= True;
end;

destructor TAnimLabel.Destroy;
begin
  FTimer.Free;
  inherited destroy;
end;

procedure TAnimLabel.SetVelocidad(Valor: Integer);
begin
  If FVelocidad <> Valor then
  begin
    if Valor <= 0 then
    begin
      FVelocidad:= 0;
      FTimer.Enabled:= FALSE;
    end else
    begin
      FVelocidad:= 0;
      FTimer.Enabled:= FALSE;
    end;
    FTimer.Interval:= FVelocidad;
  end;
end;

{ TBlinkLabel }

procedure TBlinkLabel.Animar(Sender: TObject);
begin
  Visible:= not(Visible);
end;

{ TMarqueeLabel }

procedure TMarqueeLabel.Animar(Sender: TObject);
var
  Str: String;
begin
  if Assigned(FEdit) then
    Str:= FEdit.Text
  else
    Str:= '';
  if Length(Str) > 0 then
  begin
    FIndice:= ((FIndice + 1) mod Length(Str)) + 1;
    Caption:= Copy(Str,FIndice,MAXINT) + Copy(Str,1,FIndice - 1);
  end else
    Caption:= '';
end;

procedure Register;
begin
  RegisterComponents('Curso', [TBlinkLabel]);
  RegisterComponents('Curso', [TMarqueeLabel]);
end;

end.
Ahora el TMarqueeLabel tiene una propiedad nueva llamada Edit. Colocas el TMarqueeLabel en el formulario, colocas un TEdit y asignas ese TEdit a la propiedad Edit.

¿Que te parece ahora?

Última edición por seoane fecha: 05-08-2007 a las 20:48:04.
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
tlabel enabled anubis Varios 12 10-05-2007 08:32:50
un TLabel como Hipervínculo zuriel_zrf Internet 9 06-01-2006 22:11:49
tlabel como Centrar ? Pascual Montes Varios 4 11-06-2005 02:53:33
un TLabel para ir a pagina web zuriel_zrf Internet 1 19-02-2004 11:16:29
Tlabel enlazado a un TDBedit CORBATIN OOP 2 15-09-2003 00:29:10


La franja horaria es GMT +2. Ahora son las 15:53:37.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi