DialogPage events

RICOLEBORICOLEBO FRANCE
edited 1:43AM in FastReport 3.0
I want to open a dialogPage before print a report to set a variable in the report and
use it to build the SqlCommandText in my program. (I have set DialogPage to visible false in the report to not have 2 times the dialogBox)

What I want to do is :

- frxReport1.LoadFromFile('myReport')

- Page := TfrxDialogPage(frxReport1.FindObject('DialogPage1'));
- Page.ShowModal; -> open the dialogPage (Ok)

- DialogPage1.btOKOnClick build my Sql.CommanText in a variable (in the report)

- Set my SQL.commandText with the variable of the report and then active the dataSet (in my program)

- frxReport1.print

My problem is : No event fire when dialogPage is called by showModal ! DialogPage1.btOKOnClick works only when the dialogPage is open with
the frxReport.Print or frxReport.PrepareReport (It's to late to change the query).

Note : Please tell me if I can use dialogPage to do this or if dialogPage exist only to add comments to the report.

Thank you
Eric

Comments

  • edited 1:43AM
    Try this:

    frxReport1.LoadFromFile('myReport');
    frxReport1.Script.Compile;//Compile script
    Page := TfrxDialogPage(frxReport1.FindObject('DialogPage1'));
    Page.ShowModal;
  • RICOLEBORICOLEBO FRANCE
    edited 1:43AM
    Thank you

    I try this, but it doesn't work (no effect) ;)
  • edited 1:43AM
    frxReport1.Script.Run() ?
  • RICOLEBORICOLEBO FRANCE
    edited 1:43AM
    No ;) ;)

    And I just to see that the variables input in the dialogPage are not available
    in the report !
    I put a TfrxMemoView with [START_DATE.DATE] and the value of the parameter is not displayed.
  • edited 1:43AM
    Now It must work :


    frxReport1.LoadFromFile('myReport');
    frxReport1.PrepareReport();//
    Page := TfrxDialogPage(frxReport1.FindObject('DialogPage1'));
    Page.ShowModal;
  • RICOLEBORICOLEBO FRANCE
    edited 1:43AM
    Thank you DEN for your reply

    But NO ! PrepareReport doen't change something !

    I don't know if it's a bug, but it seems that use DialogPage.ShowModal
    show only the dialog page and do nothing else, because the variables of
    the dialogPage are not set in the report and no event are fired ?
  • edited 1:43AM
    I tryed it on little example and it works.
    I can send you example.
  • RICOLEBORICOLEBO FRANCE
    edited 1:43AM
    Thank you
    Send me please your example
  • edited 1:43AM
    Can you give me your e-mail(in PM)?
  • RICOLEBORICOLEBO FRANCE
    edited 1:43AM
    I have solved my problem by using a script variable and PrepareScript + engine.Run like that

    Page := TfrxDialogPage(frxReport1.FindObject('DialogPage1'));
    Page.Visible := True;
    frxReport1.PrepareScript;
    try
    frxReport1.Engine.Run; // Silent exception (no possible with prepareReport)
    except end;

    Page.Visible := False;

    => Then, Set my commandText with the script variable

    frxReport1.PrepareReport;
    frxReport1.Print;

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.