Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Text Search Parameter Saving (part deaux)

edited February 2004 in General
I am attaching a sample piece of code.

The code sets ppReport1.TextSearchSettings.DefaultString to 'Apples'

The user changes the text to search for to 'Label'

When Close is clicked on the Preview,
ppReport1.TextSearchSettings.DefaultString is still 'Apples'

(same holds true for ppReport1.TextSearchSettings.WholeWord)

What I need to do is capture what the user has set so that it can be used
for the default in subesequent reports.

Thanks

Joe

Comments

  • edited February 2004
    Here is the code (I hope)

  • edited February 2004
    Since I can't seem to attach the code, here it is (sans the form)
    unit sample;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, ppPrnabl, ppClass, ppCtrls, ppBands, ppCache, ppComm, ppRelatv,
    ppProd, ppReport, StdCtrls, ppParameter;
    type
    TForm1 = class(TForm)
    ppReport1: TppReport;
    ppHeaderBand1: TppHeaderBand;
    ppDetailBand1: TppDetailBand;
    ppFooterBand1: TppFooterBand;
    ppLabel1: TppLabel;
    ppLabel2: TppLabel;
    ppLabel3: TppLabel;
    ppLabel4: TppLabel;
    ppLabel5: TppLabel;
    ppLabel6: TppLabel;
    ppLabel7: TppLabel;
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    ppParameterList1: TppParameterList;
    Label3: TLabel;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ppReport1PreviewFormClose(Sender: TObject);
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ppReport1.Print;
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    ppReport1.TextSearchSettings.DefaultString := 'APPLES';
    Label1.Caption := 'Original: ' +
    ppReport1.TextSearchSettings.DefaultString;

    If True = ppReport1.TextSearchSettings.WholeWord then
    Label3.Caption := 'Whole Word = True'
    else
    Label3.Caption := 'Whole Word = False'
    end;

    procedure TForm1.ppReport1PreviewFormClose(Sender: TObject);
    begin
    Label2.Caption := 'Change To: ' +
    ppReport1.TextSearchSettings.DefaultString;
    If True = ppReport1.TextSearchSettings.WholeWord then
    Label4.Caption := 'Whole Word = True'
    else
    Label4.Caption := 'Whole Word = False'
    end;

    end.
This discussion has been closed.