Ver Mensaje Individual
  #1  
Antiguo 15-09-2011
Avatar de hgiacobone
hgiacobone hgiacobone is offline
Miembro
 
Registrado: may 2003
Ubicación: La Plata, Bs. As., Argentina
Posts: 165
Reputación: 24
hgiacobone Va por buen camino
Unhappy Problema de creación en Runtime

Hola amigos,
Tengo un Form pre-diseñado a modo de Diálogo Modal, que solo contiene un TPanel y dos TBitButtons para el Ok y el Cancel respectivamente.
Este Form se crea y se invoca solo en runtime. Se incrustan en el interior del TPanel los componentes que en ese momento se necesiten.
Por ej:
Código Delphi [-]
procedure TForm1.ButonXXXOnClick(Sender: TObject);
   procedure Check1_OnClick(Sender: TObject);
   begin
      Date1.Enabled:= not (Sender As TCheckbox).Checked;
   end;
var
   MyForm: TfrmCustomDlg;
   Label1: TLable;
   Date1: TComboDate;
   Chk1: TCheckbox;
begin
   MyForm:= TfrmCustomDlg.Create(self);
   TRY
     MyForm.BtnOK.Caption:= '&Ingresar';
     MyForm.BtnCAN.Caption:='&Salir';
     
     Label1:= TLabel.Create(MyForm);
     Label1.Parent:= MyForm.Panel1;
     Label1.Caption:= 'Indique la fecha:';
     Label1.Left:=10;
     Label1.Top:=10;

     Date1:= TCombodate.Create(MyForm);
     Date1.Parent:= MyForm.Panel1;
     Date1.Date:= Now;
     Date1.Left:=10;
     Date1.Top:=50;

     Chk1:= TCheckbox.Create(MyForm);
     Chk1.Parent:= MyForm.Panel1;
     Chk1.Caption:= 'Sin fecha';
     Chk1.Left:=10;
     Chk1.Top:=70;
     Chk1.OnClick:= Check1_OnClick;

        if (MyForm.ShowModal = mrOK) then
        begin
          {aqui se realiza el procesamiento posterior}
        end;
   FINALLY
     MyForm.Free;
   END;
end;

Esto funcionaba bien a excepción cuando le agregué lo que está marcado en color rojo.

La duda a plantear es que no puedo crear el procedimiento que debe responder al evento OnClick de la casilla.

¿Quién sabe cómo hacerlo?
__________________
Gracias de antemano por vuestra ayuda.
·.:*:.·Yako·.:*:.·
Responder Con Cita