Ver Mensaje Individual
  #3  
Antiguo 24-02-2008
Avatar de Caral
[Caral] Caral is offline
Miembro Premium
 
Registrado: ago 2006
Posts: 7.659
Reputación: 25
Caral Va por buen camino
Hola
Aparte de lo dicho por el Maestro dec, que ademas no se me hubiera ocurrido (esta genial).

Este codigo lo encontre por ahi, crea un progressBar en un dialog.

Código Delphi [-]
procedure TForm1.DialogTimer(Sender: TObject);
var    
  aPB : TProgressBar; 
begin    
  if NOT (Sender is TTimer) then 
    Exit;
  if ((Sender as TTimer).Owner) is TForm then    
    with ((Sender as TTimer).Owner) as TForm do    
    begin      
      aPB := TProgressBar(FindComponent('Progress'));
      if aPB.Position >= aPB.Max then        
        ModalResult := mrCancel      
      else        
        aPB.StepIt;    
    end;
end;

procedure TForm1.FormCreate(Sender: TObject);
var    
  AMsgDialog : TForm;    
  AProgressBar : TProgressBar;    
  ATimer : TTimer; 
begin    
  AMsgDialog := CreateMessageDialog('El Reporte esta por ejecutarse, Espere', 
   mtWarning, []) ;
  AProgressBar := TProgressBar.Create(AMsgDialog) ;
  ATimer := TTimer.Create(AMsgDialog) ;
  with AMsgDialog do    
  try     
    Tag := 15; // aqui determinas los segundos
    Caption := 'Reportes';
    Height := 100;

    with AProgressBar do begin      
      Name := 'Progress';
      Parent := AMsgDialog;
      Max := AMsgDialog.Tag;
      Step := 1;
      Top := 50;
      Left := 8;
      Width := AMsgDialog.ClientWidth - 16;
    end;

    with ATimer do begin      
      Interval := 1000;      
      OnTimer:=DialogTimer;     
    end;

    case ShowModal of 
      ID_CANCEL: //
    end;
  finally     
    ATimer.OnTimer := nil;
    Free;
  end;
end;


Ahora solo seria aplicarlo en tu codigo, supongo.

Saludos

Edito: no puedo arreglar el codigo con las etiquetas.

Última edición por dec fecha: 24-02-2008 a las 08:49:25.
Responder Con Cita