Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Error Qrdesign ayuda.. (https://www.clubdelphi.com/foros/showthread.php?t=67607)

Rofocale 26-04-2010 09:07:05

Error Qrdesign ayuda..
 
Código Delphi [-]
procedure TfInformee.facturaDesignAfterReportLoaded(Form: TForm;
  QRD: TComponent);
var
  totalx : Double;
  L: TQRDesignLabel;

begin
totalx := md.tfacturas.FieldByName('Total').AsFloat;
L:=TQRDesignLabel(Form.FindComponent('muestracon'));
L.Caption := FloatToStr(totalx);

end;

Hola a todos tengo un error estoy practicando y quiero mostrar el contenido que tiene el campo total de una tabla en un label de un reporte estoy usando quickreport y qrdesign al usar ese codigo me da error access violation
que estoy haciendo mal ?
espero respuestas

gracias

toni.vi 26-04-2010 13:27:55

1.- Cambiando el AfterReportLoaded por BandaBeforePrint
2.- Preguntas por la banda que se va a imprimir.
3.- Buscas el componente.
4.- le asignas el valor que quieras

Utiliza algo así.
Código Delphi [-]
procedure TForm1.BandaBeforePrint(Sender: TQRCustomBand; var PrintBand: Boolean);
var                                                                                  
  vComponente : TComponent;     
  totalx : Double;
                                                       
begin                                                                                
  if UpperCase(sender.Name) = 'BANDADETALLE' then                                    
  begin                                                                              

     vComponente := Form1.ReportDesignerDialog1.ReportForm.FindComponent('muestracon');
     if (vComponente as TQRLabel) <> Nil then
     begin
       totalx := md.tfacturas.FieldByName('Total').AsFloat;

       (vComponente as TQRLabel).Caption := FloatToStr(totalx);
       (vComponente as TQRLabel).Enabled := True;
     end;

  end;
end;

Rofocale 26-04-2010 14:52:35

Hola disculpa el programa compila todo bien pero no muestra el resultado dentro del label osea no aparece nada solo dice reportlabel
Código Delphi [-]
procedure TfInformee.facturaDesignBandBeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);

var
  vComponente : TComponent;
  totalx : Double;

begin
  if UpperCase(sender.Name) = 'PIE' then
  begin

     vComponente := fInformee.facturadesign.ReportForm.FindComponent('muestracon');
     if (vComponente as TQRLabel) <> Nil then
     begin
       totalx := md.tfacturas.FieldByName('Total').AsFloat;

       (vComponente as TQRLabel).Caption := FloatToStr(totalx);
       (vComponente as TQRLabel).Enabled := True;
     end;

  end;
end;

marcoszorrilla 26-04-2010 15:08:42

Me da la impresión de que el evento no se ejecuta, por qué no metes dentro un ShowMessage('xxxx'); para ver si entra hasta esa zona o no?.

Un Saludo.

Rofocale 26-04-2010 15:38:15

algo anda mal.. segun el showmessage el primer if se ejecuta

Rofocale 26-04-2010 16:47:30

necesito una ayuda si le quito la condicion para forzar a que se ejecute todas las sentencias el programa da error de access violation con mi primer codigo como lo estaba usando tmb da error de access violation porque ?

soy novato :(

Rofocale 26-04-2010 18:40:46

Bueno ya me salio a ver si les sirve a ustedes esto es para convertir el total de una factura a letras con el componente atexto que descargue de esta web

Código Delphi [-]
procedure TfInformee.facturaDesignBandBeforePrint(Sender: TQRCustomBand;
  var PrintBand: Boolean);

var
  vComponente : TComponent;
  totalx : Double;

begin
  if UpperCase(sender.Name) = 'PIE' then
  begin

     vComponente := fInformee.facturadesign.ReportForm.FindComponent('muestracon');
     if vComponente is TQRLabel then
   begin
       totalx := md.tfacturas.FieldByName('Total').AsFloat;
       Letras1.Numero := totalx;
       (vComponente as TQRLabel).Caption := Letras1.AsString;
       (vComponente as TQRLabel).Enabled := True;

   end;

  end;
end;


La franja horaria es GMT +2. Ahora son las 11:35:14.

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