How do you add a pop up menu in preview? i get an access violation when i Report.PreviewForm.PopupMenu.Items.Add(FoMenu) using a previously created pop up menu item
The preview form in ReportBuilder does not utilize the TForm.PopupMenu property (or technically include a popup menu at all). What exactly would you like to see happen?
I want to be able to add calls to my code from a print preview, and i had thought that i could add a popup menu in code to do this. the report.previewform does have a popup menu property but it gives a gpf if i access it. You have a pop up menu to collapse the outline etc, is it possible to override or add to this?
I thought that i could add the onpreviewformcreate event handler and do it in there. If i have a pop up menu on my form on which i put the report can i connect it to reportbuilder, or rather get rb to connect to it?
Lawrence
I have reportbuilder 9.03 but do i need to upgrade for this?
The outline popup menu is assigned to the Viewer object in the Preview Window. This will take precidence over the popup menu of the form. Try accessing the PreviewForm.OutlineViewer.PopupMenu property instead.
For 9.03, I do not believe we gave access to the OutlineViewer from the preview form. I believe you would need to create a preview plugin in order to gain access to the object and customize the popup menu.
----------------------------------------- Article: Creating a Preview Plugin -----------------------------------------
Q: I've followed the tutorials and registered a Preview Form replacement but that did not affect the TppDesigner's Preview workspace.
A: Do not use the form replacement, but rather, there is a different architecture built into the preview form that is registered by default.
You will need to register a TppPreview descendent. The class you register is used to create the preview controls inside the standard print preview form and the designer preview workspace.
Here is an example of creating a simple custom preview that access the viewer its been assigned in order to change the page color. You can also do more advanced operations such as adding and removing buttons and change the behavior of the preview form. Access the inherited controls via. protected properties and override the virtual methods in order to customize behavior.
Open ppPreview.pas and view the TppPreview class as a guide to create a custom preview descendent.
unit MyPreviewPlugin;
interface
uses ppPreview;
type TMyPreviewPlugin = class(TppPreview) public procedure BeforePreview; override;
end;
implementation
uses Graphics;
procedure TMyPreviewPlugin.BeforePreview; begin inherited BeforePreview;
Comments
The preview form in ReportBuilder does not utilize the TForm.PopupMenu
property (or technically include a popup menu at all). What exactly would
you like to see happen?
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
thought that i could add a popup menu in code to do this.
the report.previewform does have a popup menu property but it gives a gpf if
i access it. You have a pop up menu to collapse the outline etc, is it
possible to override or add to this?
I thought that i could add the onpreviewformcreate event handler and do it
in there. If i have a pop up menu on my form on which i put the report can i
connect it to reportbuilder, or rather get rb to connect to it?
Lawrence
I have reportbuilder 9.03 but do i need to upgrade for this?
The outline popup menu is assigned to the Viewer object in the Preview
Window. This will take precidence over the popup menu of the form. Try
accessing the PreviewForm.OutlineViewer.PopupMenu property instead.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
in 9.03 there does not seem to be a previewform.outlineviewer, with or
without a popup menu.
Can I add to the pop up menu that already exists? I was hoping that it would
not be too difficult.
Thanks for your help....
Lawrence
For 9.03, I do not believe we gave access to the OutlineViewer from the
preview form. I believe you would need to create a preview plugin in order
to gain access to the object and customize the popup menu.
-----------------------------------------
Article: Creating a Preview Plugin
-----------------------------------------
Q: I've followed the tutorials and registered a Preview Form replacement but
that did not affect the TppDesigner's Preview workspace.
A: Do not use the form replacement, but rather, there is a different
architecture built into the preview form that is registered by default.
You will need to register a TppPreview descendent. The class you register
is used to create the preview controls inside the standard print preview
form and the designer preview workspace.
Here is an example of creating a simple custom preview that access the
viewer its been assigned in order to change the page color. You can also do
more advanced operations such as adding and removing buttons and change the
behavior of the preview form. Access the inherited controls via. protected
properties and override the virtual methods in order to customize behavior.
Open ppPreview.pas and view the TppPreview class as a guide to create a
custom preview descendent.
unit MyPreviewPlugin;
interface
uses
ppPreview;
type
TMyPreviewPlugin = class(TppPreview)
public
procedure BeforePreview; override;
end;
implementation
uses
Graphics;
procedure TMyPreviewPlugin.BeforePreview;
begin
inherited BeforePreview;
Viewer.PageColor := clRed;
end;
initialization
TppPreviewPlugIn.Register(TMyPreviewPlugin);
finalization
TppPreviewPlugIn.UnRegister(TMyPreviewPlugin);
end.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
that looks cool. i will try it, i can see that i was trying it the wrong
way.
Thats exactly what i want, and i will see how it goes.
Lawrence Karthauser