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

toolbar

edited November 2005 in End User
Is there a way to add a toolbar to the toolbar area of the end user reports?

Or a way to disable certain button?

Thanks,
Rob

Comments

  • edited November 2005
    Hi Rob,

    Are you talking about the Preview window or the Designer window? The
    Preview window can be fully customized by creating a preview plugin. See
    the article below on how this is done. Unfortunately the Designer window is
    not very customizable. The following link is to an example of how to hide
    the print button in the preview form.

    http://www.digital-metaphors.com/tips/PreviewerHidePrintButton.zip

    -----------------------------------------
    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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2005
    I ment the designer window.

  • edited November 2005
    Hi

    You can use the following code.
    We are using the OnShow-event and Assigned because the initializations of
    the toolbars are not done before in RB9. In RB7 you can do it in the
    OnCreate event.
    __________

    procedure TReportDesignerModule.ReportDesignerShow(Sender: TObject);
    begin
    FToolbarManager := TppDesignerWindow(ReportDesigner.Form).ToolbarManager;

    if not Assigned(StylingToolbar) then
    begin
    StylingToolbar := TppToolbar.Create(ReportDesigner.Form);
    StylingToolbar.Name := 'Styling';
    StylingToolbar.Caption := 'Styling';
    StylingToolbar.ManualDock(FToolbarManager.TopDock);
    StylingToolbar.DockRow := 6;
    StylingToolbar.Top := ((StylingToolbar.DockRow - 1) *
    FToolbarManager.TopDock.RowSize) + 1;

    // Remember to set both parent and owner to the toolbar
    StyleSelectionComboBox := TComboBox.Create(StylingToolbar);
    StyleSelectionComboBox.Parent := StylingToolbar;
    StyleSelectionComboBox.Width := 200;
    StyleSelectionComboBox.Style := csDropDownList;
    StyleSelectionComboBox.DropDownCount := 10;
    StyleSelectionComboBox.OnSelect := StyleSelectionComboBoxOnSelect;
    StyleSelectionComboBox.Enabled := False;

    // add any other components here

    FToolbarManager.AddToolbar('Styling', StylingToolbar);
    end;
    end;
    ____________

    Best regards
    Steffen

  • edited November 2005
    Thanks Steffen,

    Good stuff :).

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2005
    Thanks that works great.

    -Rob

This discussion has been closed.