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

Okd version RTM

edited June 2008 in General
Hi,

I have to convert an old application from Delphi 1 with RB 3.52 to Delphi 2007 with the newest RB.
Recently, I finished porting to D2007 and start with reports.

The application has the following lines:
ppReport.Template.FileName := 'MyReport.rtm';
ppReport.Template.LoadFromFile;
ppReport.Device := dvScreen;
ppDesigner.ShowModal;

LoadFromFile is executed without problems.
But on ppDesigner.ShowModal I get "Toolbar item index out of range".

Obviously, something changed in RTM format.
I can create new reports. But I have a large number of old 3.52 RTM files, and I wish to use them.
Has anybody some idea?

Thank you,
Mahris

Comments

  • edited June 2008
    Hi Maris,

    If possible please send one of the templates that causes the problem in .zip
    format to support@digital-metaphors.com and we'll try to recreate and fix
    the problem here.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2008
    Nico Cizik (Digital Metaphors) raxtija 2008.06.02. 19:10:


    Hi Nico,

    I hope you have not started with my RTM exploring.
    The problem exists, but probably it is not RTM problem.

    I can open these RTM in design time.

    In runtime, a typical form has the following lines:
    ppDesigner.MergeMenu := MainForm.ppReportMenu;
    ppReport.Template.FileName := MainForm.ppReportName;
    ppReport.Template.LoadFromFile;
    ppReport.Device := ppReportDevice;
    if ppIsReportPrint then
    ppReport.Print
    else begin
    ppDesigner.ShowModal;
    end;

    The first branch, ppReport.Print, works.
    The second, ppDesigner.ShowModal fails with "Toolbar item index out of range".
    Currently, I suppose that it may be a wrong message from the trial version.


    But there arises another problem.
    My company wishes to by Enterprise. But we wish to pay through bank using invoice received from you.
    Unfortunately, our messages to sales@digital-metaphors.com remain unanswered.


    Thank you,
    Mahris
  • edited June 2008

    I just tried to open the .rtm files - design-time and run-time and did not
    encounter any issues.

    One thing you might want to do is to delete your existing RBuilder.ini from
    the Windows directory. RB 10 will create a new one.

    Perhaps the error is related to your merge menu or to some custom code that
    you written to manipulate the menus and/or toolbars? A simple example
    project would be helpful.

    Here is an example that shows how to customize the RB 10 Designer. Perhaps
    it will be helpful.


    www.digital-metaphors.com/tips/Designer10_CustomizeMenusAndToolbars.zip

    Please resend your email to sales@digital-metaphors.com, they have not
    received anything.



    Best regards,



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited June 2008
    Thanks for all responses.

    And sorry for the time you wasted by examining my RTMs.

    At least, my company bought Enterprise, and I recompiled it with debug options (previously I used trial, without sources).

    The problem really is in the statement
    ppDesigner.MergeMenu := MainForm.ppReportMenu;
    I could not detect it earlier because the real merging is delayed.

    However, it is your problem, concretely - problem of the new TppMenuBar invoked in v10.

    The only item of MainForm.ppReportMenu has GroupIndex=99. The author of the program I am porting proposed to have it in the right side.
    It worked with RB 3.52, and, as I see from sources, it should work up to RB 9 because there remains usual Borland menu.

    In ppToolbarTBX, TppMenuBar.Merge we have
    liMenuIndex := FindGroupIndex(lTMenuItem.GroupIndex);
    if lTMenuItem.GroupIndex = Items[liMenuIndex].GroupIndex then

    In case of 99, match is not found, and FindGroupIndex returns 5.
    The following comparison refers to Items[5], but we have only 5 items - exception.

    I recently changed 99 to 45, now everything works.
    But I will change the mentioned compare in your source.

    Best regards,
    Mahris


    Nard Moseley (Digital Metaphors) raxtija 2008.06.03. 17:29:
This discussion has been closed.