Re: labels and quickreports

Martin <[email protected]> Tue, 04 Mar 2003 19:46:37 +1100
Newsgroups gmane.comp.lang.delphi.quick-reports
Message-ID <[email protected]>
never mind, i have worked it out.

At 07:36 PM 4/03/03 +1100, you wrote:

>i have tried the changes you have suggested but now the OnNeedData event
>doesnt seem to be getting fired as the report goes into preview state.
>
>At 11:33 PM 3/03/03 -0800, you wrote:
>
> >On Mon, 03 Mar 2003 23:24:21 -0800 (PST), Martin wrote:
> >Hi,
> >
> >I think you need to expand your OnNeed a bit.
> >
> >     inc(giIndex); // Always !!
> >     if giIndex = giStartLabel then // First label to print
> >       qryDetail.First
> >     else if giIndex > giStartLabel then // Next label to print
> >       qryDetail.Next;
> >
> >     QRDBText1.Enabled := (giIndex >= giStartLabel); // Enable only when
> > we want to print
> >     QRDBText2.Enabled := (giIndex >= giStartLabel); // same
> >     QRDBText3.Enabled := (giIndex >= giStartLabel); // same
> >
> >     MoreData := (not qryDetail.EOF); // is there more data in the dataset ?
> >
> >Greetings Andre Mens (Author of QReport Artist)
> >
> >[email protected]
> >www.mensand.com    Home of QuickReport Artist The enduser editor for all
> >your QuickReports
> >
> >[email protected]
> >www.rapware.com  Home of all EASY products
> >   like EASY MAPI your Email sollution provider
> >   and  EASY Script Studio Customizations sollution for your applications
> > with a compleer IDE
> >   and  EASY SOAP expand your apps with WEB Methods without writing a
> > single line of CODE
> >
> >
> > >
> > > i have had a look on the companion cd. i have managed to do what i want
> > but
> > > with some side effects. because what i am doing is initially 
> disconnecting
> > > the dataset before i preview the report. and in my OnNeedData i have 
> this:
> > >
> > >    if giIndex < giStartLabel then
> > >    begin
> > >      Inc(giIndex, 1);
> > >      QRDBText1.Enabled := False;
> > >      QRDBText2.Enabled := False;
> > >      QRDBText3.Enabled := False;
> > >    end
> > >    else
> > >    begin
> > >      if rptLabels.DataSet = nil then rptLabels.DataSet := qryDetails;
> > >      QRDBText1.Enabled := True;
> > >      QRDBText2.Enabled := True;
> > >      QRDBText3.Enabled := True;
> > >    end;
> > >    MoreData := True;
> > >
> > > both giIndex and giStartLabel are global variables of integer initialised
> > > to 1, but giStartLabel will be changed depending on what is passed into
> > the
> > > calling procedure. which looks like this
> > >
> > > procedure PrintLabels(piJobNo: Integer; pbPrint: Boolean; AOwner:
> > TComponent);
> > > var lsResult: String;
> > > const
> > >    csSelect = 'Select * From Details Where JobNo = %d';
> > > begin
> > >    giIndex := 1;
> > >    lsResult := InputBox(Application.Title, 'Enter Start label
> > position', '1');
> > >    if (Trim(lsResult) <> '') and (StrToIntDef(lsResult, 0) > 0) then
> > >      giStartLabel := StrToInt(lsResult);
> > >
> > >    frmLabels := TfrmLabels.Create(AOwner);
> > >    with frmLabels do
> > >    begin
> > >      qryDetails.SQL.Text := Format(csSelect, [piJobNo]);
> > >      qryDetails.Open;
> > >
> > >      // logic to disconnect the query component from the detail until
> > >      // set number of labels has been met.
> > >      if giStartLabel > 1 then
> > >        rptLabels.DataSet := nil;
> > >
> > >      if pbPrint then
> > >        rptLabels.Print
> > >      else
> > >        rptLabels.Preview;
> > >    end;
> > >    FreeAndNil(frmLabels);
> > > end;
> > >
> > > then end result is that it starts at the correct position but it doesnt
> > > reconnect the Dataset back up correctly and keeps producing labels 
> until i
> > > cancel the report.
> >
> >
> >=============================================
> >QReport Artist 5 - http://www.mensand.com/
> >The new version is available for Delphi 5.0 ,
> >Delphi 4.0 and Delphi 3, BC++Builder 3.0. and BC++Builder 4.0
> >=============================================
> >
> >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> >---
> >Incoming mail is certified Virus Free.
> >Checked by AVG anti-virus system (http://www.grisoft.com).
> >Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/03
>
>   ----------
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/03
>
>
>[Non-text portions of this message have been removed]
>
>
>
>=============================================
>QReport Artist 5 - http://www.mensand.com/
>The new version is available for Delphi 5.0 ,
>Delphi 4.0 and Delphi 3, BC++Builder 3.0. and BC++Builder 4.0
>=============================================
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/03

  ----------


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.459 / Virus Database: 258 - Release Date: 25/02/03


[Non-text portions of this message have been removed]


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/LIgTpC/vN2EAA/xGHJAA/i7folB/TM
---------------------------------------------------------------------~->

=============================================
QReport Artist 5 - http://www.mensand.com/
The new version is available for Delphi 5.0 ,
Delphi 4.0 and Delphi 3, BC++Builder 3.0. and BC++Builder 4.0 
============================================= 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/