Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #6  
Antiguo 06-07-2008
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Poder: 22
cHackAll Va por buen camino
Lo que pides es un Kludge, el problema es que debes manejar individualmente cada evento y tu aplicacion crece considerablemente;

Código Delphi [-]
function AsignaOnClick(Indice: string): TNotifyEvent;
begin
 case StrToInt(Indice) of
  1: Result := Form1.STTIPO1;
  2: Result := Form1.STTIPO2;
  3: Result := Form1.STTIPO3;
  4: Result := Form1.STTIPO4;
  5: Result := Form1.STTIPO5;
  6: Result := Form1.STTIPO6;
  //...
 end;
end;

La mejor solución;

Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
var Count: Cardinal;
begin
 Count := 66;
 while LongBool(Count) do
  with TStaticText.Create(nil) do
   begin
    Dec(Count);
    Tag := Count;

    Left := 5 + ((Count mod 10) * 50);
    Top := 18 + ((Count div 10) * 30);

    Caption := IntToStr(Count);
    Font.Name := 'Comic Sans MS';
    Font.Size := 19;

    OnClick := StaticTextClick;
    Parent := Form1;
   end;
end;

procedure TForm1.StaticTextClick(Sender: TObject);
begin
 with Sender as TStaticText do
  begin
   ShowMessage(Caption);
   case Tag of
    1: ShowMessage('Accion especial para el primer StaticText!!!');
    2: begin
        //...
       end;
    3: ;
     //...
   end;
  end;
end;

Saludos
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

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
Asignar evento OnDrawColumnCell en tiempo de ejecución gluglu OOP 6 01-06-2007 13:14:58
Usar evento OnClick en imagen creada en ejecucion ilcapo C++ Builder 8 12-04-2007 21:08:51
Asignar evento Oncalcfield en tiempo de ejecucion el_barto Conexión con bases de datos 5 06-09-2005 00:08:46
Asignar la ruta de tablas en tiempo de ejecucion tortelini Varios 2 19-03-2005 12:13:53
Asignar procedimiento al evento OnClick neon OOP 2 28-10-2004 11:53:21


La franja horaria es GMT +2. Ahora son las 17:49:04.


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