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

OutlineNotebook.Initialize Runtime-Error

Hi,

we have a Delphi-Formular with RB components like ppViewer, ppDesigner and so on. In code behind we create our own OutlineNotebook.
Here is the code:

...
fOutlineNotebook := TppOutlineNotebook.Create(Self);
fOutlineNotebook.Preview := Self;
fOutlineNotebook.Viewer := ppViewer1;
fOutlineNotebook.Initialize(tcThumbnail); // tcThumbnail is a TTabSheet
fOutlineNotebook.Visible := True;
fOutlineNotebook.ThumbnailsVisibility(True);
fOutlineNotebook.ThumbnailsEnabled := True;
fOutlineNotebook.ThumbnailViewer.AutoGenerate := True;
fOutlineNotebook.ThumbnailViewer.ThumbnailSize := tsSmall;
...

Everything works fine in Delphi XE4 and RB 20. Now we have had an update to Delphi 11 und RB 22 and the Initialize method generates a runtime error "access violation at 0x012b0238".
It's about this line:

fOutlineNotebook.Initialize(tcThumbnail); // tcThumbnail is a TTabSheet

How can I fix this problem?

Thanks in advance

Michael

Comments

  • Hi Michael,

    For the latest version(s) of ReportBuilder a ToolImageList is required for the OutlineNotebook to initialize. See the TppPreview.CreateOutlineNotebook routine for how this is done in RB.
    uses
    ppToolResources;

    ...
    FToolImageList := TppToolImageList.Create(Self);
    ...
    fOutlineNotebook.ToolImageList := FToolImageList;
    ...
    Also, it appears you are setting the Preview property to the form. The OutlineNotebook is designed to work inside a TppPreview so while this may function now, it could cause issues in the future. Moving forward, I suggest commenting this line out or consider using a preview plugin to customize the existing preview the way you need.

    https://rbwiki.digital-metaphors.com/plugins/dialogs/preview-plugin/
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
Sign In or Register to comment.