Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 05-02-2008
Avatar de Héctor Randolph
[Héctor Randolph] Héctor Randolph is offline
Miembro Premium
 
Registrado: dic 2004
Posts: 882
Poder: 20
Héctor Randolph Va por buen camino
Aquí les dejo el código de una pequeña prueba que hice. Coloqué un reporte y un botón dentro del formulario. La idea es capturar el evento que se genera al cerrar la vista previa.

Código Delphi [-]
type
  TForm1 = class(TForm)
    QuickRep1: TQuickRep;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure QuickRep1BeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
  private
    { Private declarations }
     procedure CerrarPreview(Sender: TObject; var Action: TCloseAction);
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.QuickRep1BeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
var
 I: Integer;

begin
  for I:=0 to Screen.FormCount-1 do
  begin
    if Screen.Forms[i].ClassName='TQRStandardPreview' then
    begin
      Screen.Forms[i].OnClose:=CerrarPreview;
    end;
  end;
end;

procedure TForm1.CerrarPreview(Sender: TObject; var Action: TCloseAction);
begin
  ShowMessage('Se cerró el formulario de la vista previa.');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  QuickRep1.Preview;
end;

end.


Saludos
Responder Con Cita
  #2  
Antiguo 05-02-2008
keyboy keyboy is offline
Miembro
 
Registrado: oct 2004
Posts: 367
Poder: 20
keyboy Va por buen camino
¿Y si usan a la misma ventana del preview como variable "booleana"?

Código Delphi [-]
function IsPreviewActive: Boolean;
var
  I: Integer;

begin
  Result := false;

  for I := 0 to Screen.FormCount - 1 do
    if Screen.Forms[i].ClassName = 'TQRStandardPreview' then
    begin
      Result := true;
      break;
    end;
end;

Así, al hacer el preview sólo tienen que examinar el valor de la función:

Código Delphi [-]
if IsPreviewActive then
  ShowMessage('Ya hay una vista preliminar activa')
else
  QuickRep1.Preview;

Bye
Responder Con Cita
  #3  
Antiguo 06-02-2008
Avatar de StartKill
StartKill StartKill is offline
Miembro
 
Registrado: ene 2004
Posts: 299
Poder: 21
StartKill Va por buen camino
Señores.

Gracias por su ayuda, me servieron todas sus sus ideas. (hasta la ultima linea de código)

Tambien encontré esto, http://www.rinconcitodelphi.com/arti...rt/QReport.pdf aun no lo he leido, creo ya no sera necesario gracias a Uds.

Your friend
StartKill
Lima-Perú
Responder Con Cita
Respuesta



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
Dos QRReports Preview Print TONIAM Impresión 1 12-07-2007 12:15:36
Jv Print Preview ?! MaMu Impresión 0 29-04-2007 14:40:57
TDBCHAR, print preview albertmac Gráficos 0 08-03-2007 19:42:09
Problemas con el Print preview trygvekor Impresión 2 27-11-2006 06:00:26
Alquien conoce al Print Preview Active X polopolo Impresión 0 30-06-2005 07:27:47


La franja horaria es GMT +2. Ahora son las 09:09:27.


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