Text Search - Capturing user changes
I'm still having a problem with this.
(Let's remove the event to keep it simple)
The sample looks like:
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.
I set TextSearchSettings.DefaultString and take the default for WholeWord
The user right clicks in the Preview pane and changes WholeWord to Truem and
enters some text to search for.
The user clicks CLOSE
Upon ppReportPreviewFormClose, the original DefaultString and WholeWord are
displayed, not the changed values.
How can I get to the changed values?
(Let's remove the event to keep it simple)
The sample looks like:
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.
I set TextSearchSettings.DefaultString and take the default for WholeWord
The user right clicks in the Preview pane and changes WholeWord to Truem and
enters some text to search for.
The user clicks CLOSE
Upon ppReportPreviewFormClose, the original DefaultString and WholeWord are
displayed, not the changed values.
How can I get to the changed values?
This discussion has been closed.
Comments
I'm in the process of researching this issue. I'll get back to you when I
get something ASAP.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
After re-figuring out how the TextSearch feature works (a learning
experience for me), it looks as though the TextSearch preview. Retrieves the
TextSearchSettings from the report object, then makes a local copy of them
for use in the previewer. This is the reason the textsearchsettings of the
report are not updated when you change them in the preview.
They are however updated when you use the Report Designer at runtime. This
is because the Report Designer makes use of the
TppTextSearchPreview.AfterPrint method which in turn updated the
TextSearchSettings property of the report. You could possibly write a
custom preview plugin and custom TextSearchPreview to emmulate this
behavior.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I was really hoping that there was a simpler way. I have a major release of
our application coming up soon, and was really hoping that I could get this
in. How big of a deal is it to write a custom preview.
Or (another thought) - any way to access those local variables?
After a little more research, it looks as though you only have to create a
TextSearch Preview plugin to get access to these local variables. This is
very similar to creating a preview plugin replacement for the TppPreview.
Then you could code in an event of the TextSearchPreview that sets the
values of the Report.TextSearchSettings to that of the
TppTextSearchPreview.TextSearchSettings. It's a very "round about" way of
accessing the report object from the TextSearchPreview but you can do so
with the TppTextSearchPreview.Viewer.Report.TextSearchSettings.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com