Text Search problem
I am trying to build text search into my application. The application has
some 100+ reports.
Every report has OnPrintPreview set to call a procedure which turns on the
text search feature, and the binoculars to appear. However, clicking on
them does nothing except to toggle the button itself. The search pane does
not show. If I set the active to true in the IDE, it all works fine.
As a side note, I also change the text DefaultString, and the code is
executed, but again, nothing happens....
Also - could you help me witha global event notifier which would save the
settings (case, whole word, etc.) (to the registry).
Thnaks
some 100+ reports.
Every report has OnPrintPreview set to call a procedure which turns on the
text search feature, and the binoculars to appear. However, clicking on
them does nothing except to toggle the button itself. The search pane does
not show. If I set the active to true in the IDE, it all works fine.
As a side note, I also change the text DefaultString, and the code is
executed, but again, nothing happens....
Also - could you help me witha global event notifier which would save the
settings (case, whole word, etc.) (to the registry).
Thnaks
This discussion has been closed.
Comments
I'm sorry, I am not aware of the OnPrintPreview event, however if you are
loading a report, you need to apply the TextSearchSettings before the call
to Report.Print. If you are loading Templates in an end-user application,
you can set the TextSearchSettings in the Template.OnLoadEnd event which you
will need to define yourself. Check out the article below on creating and
using template events.
----------------------------------------------
Tech Tip: Using Template Events
----------------------------------------------
The Report.Template object has several events that can be used for
customizing what happens when a report is loaded or saved:
- OnLoadStart
- OnLoadEnd
- OnNew
- OnSaveStart
- OnSaveEnd
The OnLoadEnd and OnNew events are often used to perform actions related
to report and data initialization.
The OnSaveEnd event is often used to save additional descriptive
("meta") data to the database each time the report is saved.
Example:
The Report.Template events are public and therefore must be assigned at
run-time.
1. In the private section of your form declaration you can declare an
event-handler method:
TForm = class(TForm)
private
procedure myTemplateOnLoadEndEvent(Sender: TObject);
public
end;
2. In the Form.OnCreate event, you can assign the event-handler to the
event:
procedure TForm1.FormCreate(Sender: TObject);
begin
ppReport1.Template.OnLoadEnd := myTemplateOnLoadEndEvent;
end;
3. Implement the event-handler method:
procedure TForm1.myTemplateOnLoadEndEvent(Sender: TObject);
begin
{add code here to initial the report or data, etc. }
ppReport1.PrinterSetup.MarginTop := 0.5;
end;
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com