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

How can i do a Text Search when using a custom preview form?

edited May 2005 in General
Hi,

How can i do a Text Search when using a custom preview form? I want to add
my own SearchEdit, SearchButton, SearchDoneButton, FirstButton, NextButton,
PriorButton, LastButton controls on a custom preview form and assign the
appropriate Search Operations
(stSearch,stCancel,stFirst,stNextst,Prior,stLast). Is this possible? If so
could you give me some small example how to achive this.

Greetings,
Filip Moons.

Comments

  • edited May 2005
    Hi Filip,

    Take a look at the following example. It shows how to add text search to a
    custom preview.

    http://www.digital-metaphors.com/tips/ReplaceFormAndAddSearch.zip


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2005
    Hi Nico,

    I know how to enable text searching in a custom preview form, that's not the
    problem but i want to use my own controls for the SearchEdit, SearchButton,
    SearchDoneButton, FirstButton,NextButton,PriorButton, LastButton controls,
    not the standard ones u use by enabling the AutoSearchDialog and assign the
    appropriate Search Operations
    (ppTextSearchCustomPreview.PerformSearchOperation(aSearchType:
    TppTextSearchType))
    )(stSearch,stCancel,stFirst,stNext,Prior,stLast). Is this possible? If so
    could you give me some small example how to achive this.

    Greetings,
    Filip Moons

  • edited May 2005
    Hi Filip,

    I'm still a bit unclear about what you are trying to accomplish. How does
    the AutoSearchDialog fit into what you are trying to do? It is possible to
    create a custom textsearchdialog by creating a descendent to the
    TppTextSearchPreview class and registering it. See the following example of
    this.

    http://www.digital-metaphors.com/tips/TextSearchDialog.zip


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2005
    Hi Nico,

    I'v got my own preview form where i want to place my own search edit and
    buttons on.

    TppTextSearchPreview = class(TppCustomSearchPreview)
    private
    {visual controls}
    FCaseSensitiveMenuItem: TMenuItem;
    FCurrentPageMenuItem: TMenuItem;
    FFirstButton: TSpeedButton;
    FFirstPageMenuItem: TMenuItem;
    FLastButton: TSpeedButton;
    FNextButton: TSpeedButton;
    FPopupMenu: TPopupMenu;
    FPriorButton: TSpeedButton;
    FSearchButton: TButton;
    FSearchDoneButton: TButton;
    FSearchEdit: TEdit;
    FShowAllMenuItem: TMenuItem;
    FWholeWordMenuItem: TMenuItem;

    I don't want to use TEdit/TButton but TcxEdit/tcxButton controls fi and
    link the appropriate events to them. The same i do for selecting pages on
    our own preview form fi in tcxButton_MyFirstPage.OnClick we have
    TppViewerComponentFromMyPreviewForm.FirstPage the same for Prior,Next and
    Last. Its unclear to me even if it is possible to use my own placed controls
    on our preview form fi tcxButton_SearchFirstOccurence.OnClick and link it to
    PerformSearchOperation(stFirst). In other words how do i link the different
    Search Operations to my own search controls placed on my preview form. What
    i tried as a test is this but all i got were AV's so i'm doing things the
    wrong way.

    Hope its a bit clearer now what im trying to achieve.

    Greetings,
    Filip Moons

    Explanation:
    TFormSBProcReportView is our custom made preview form
    ppReportViewer is the viewer component placed on TFormSBProcReportView
    edtSearchEdit is the edit component which contains the text i want to do a
    text search for
    btnSearchFirst is the button component which has to search for the first
    occurence of edtSearchEdit

    // Custom Preview Form
    TFormSBProcReportView = class(TFormSBProc)
    ...
    ppReportViewer: TppViewer;
    edtSearchEdit: TcxTextEdit;
    btnSearchFirst: TcxButton;
    private
    { Private declarations }
    ...
    protected
    { Protected declarations }
    ...
    public
    { Public declarations }
    ...
    end;

    var
    TextSearch: TppCustomTextSearch;

    procedure TFormSBProcReportView.FormCreate(Sender: TObject);
    begin
    inherited FormCreate(Sender);

    TextSearch := TppCustomTextSearch.Create(Nil);

    TextSearch.Viewer := ppReportViewer;
    end; {FormCreate}

    procedure TFormSBProcReportView.FormDestroy(Sender: TObject);
    begin
    if Assigned(TextSearch) then
    FreeAndNil(TextSearch);

    inherited FormDestroy(Sender);
    end; {FormDestroy}

    procedure TFormSBProcReportView.btnSearchFirstClick(Sender: TObject);
    begin
    TextSearch.SearchEdit.Text := edtSearchEdit.Text;

    TextSearch.FirstButton.Click;
    end; {btnSearchFirstClick}


  • edited May 2005
    Hi Filip,

    Sorry, we do not have any example code of this, however you can completely
    replace the TppTextSearchPreview class much like replacing the preview
    dialog or print dialog in ReportBuilder and add in your own buttons and
    functionality. All the event calls for your new controls will need to be
    similar to the ones in the TppTextSearchPreview class.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.