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

About the Designer...

edited April 2006 in General
Hi,
many thanks to Nico for his reply.

My application shows the designer via a menu choice on the main form.
Clicking on it, the code of the menu item is the following:

procedure TFSidMain.BtnRepMakerClick(Sender: TObject);
begin
ppReport1.FreeModules;
ppReport1.Template.New;
ppReport1.Modified:=False;

ppDesigner1.ShowModal;
end;

So the designer is showed with all his tabs. Working on it (accessing data,
building the project, programming with RAP, previewing) often the app give
an access violation error or other error types (like "the object has no
parent" or other errors) and the delphi ide shows the ppEndUsr unit blocked
on this procedure:

procedure TppDesigner.ShowModal;
begin
if (GetDesignerWindow <> nil) then
begin
FDesignerWindow.DesignerState := FDesignerWindow.DesignerState +
[dsModal];
try
FDesignerWindow.ShowModal; <<<<--- blocked here -------------
finally
FDesignerWindow.DesignerState := FDesignerWindow.DesignerState -
[dsModal];
end;
end;
end;

After I can only "Reset the program" because the errors are infinite.

Moreover, even if I modify the report, when I close it without saving it,
the designer don't say me that "the report was modified, do you want to save
it?" (I remember that on my other applications this message was always
displayed when the report was modified... bah!)

I'm sure that I've made some banal error, but where? I run the Designer in a
bad manner?

Any idea?

Many thanks in advance
Robert

Comments

  • edited April 2006
    Hi Robert,

    Which version of ReportBuilder/Delphi are you using? In my testing with
    ReportBuilder 10.02 and Delphi 7, the code you posted below seems to work
    correctly including with the registering of RAP and DADE.

    ReportBuilder will not check if a template is modified or not by default.
    You will need to set the Report.SaveAsTemplate property to True in order for
    this to happen.


    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2006
    Oh my... I'ts true (obviously)!
    I use RB 9 and Delphi 7.
    Thanks Nico.
    Robert

  • edited April 2006
    But I want save to RTM files not on templates. I'm confused?
    Regards
    Robert
  • edited April 2006
    The report designer is runned from the application and I want that all the
    reports created will be saved in RTM files. If I set the SaveAsTemplate
    property to True and run the program, I've the ETemplateLoadError: File Not
    Found error because the Template.FileName is empty (with
    Template.SaveTo=stFile).

    I remember that in other my apps I've set the Template.DatabaseSettings, so
    the templates where saved into the RB database tables. Now I don't want this
    database, because I create RTM files.

    Now I want do a bit of order in my mind: if I set the Template.FileName to a
    Filename like "mickymouse", into this mickymouse file will go all infos
    about all my RTM report files (like the RB database)? It's true...I'm very
    confused.
    And without the SaveAsTemplate=True I never can have the message "The report
    was modified... Do you want to save it?".

    Regards

    Robert.

  • edited April 2006

    - At Delphi design-time leave Report.SaveAsTemplate set to False. In your
    application add some code to manage the reports

    myReport.Template.OnLoadEnd := myOnLoadEndHandler;
    myReport.Template.Onnew := myOnNewHandler;
    myReport.SaveAsTemplate := True;
    myDesigner.ShowModal;

    The event-handlers would look like this...

    procedure TForm1.myOnLoadEndHandler(Sender: TObject);
    begin
    // initialize default props for existing reports
    myReport.SaveAsTemplate := True; // make sure existing reports have this
    set

    end;

    procedure TForm1.myOnNewHandler(Sender: TObject);
    begin
    // initialize default props for new reports
    myReport.SaveAsTemplate := True;

    end;




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.