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

Accessing the report designer menu items at runtime

edited November 2006 in General
I just upgraded from ReportBuilder 7 to version 10 and I'm having some
trouble migrating some of the code. For one project, I need to hide
some of the menus of the report editor. In version 7, I could do so by
name (e.g. mniFileNewReport.Visible := false), but in version 10, the
menu items are created by runtime and I can't reference them by name.
Is any way to disable or hide the menu items without iterating through
the MainMenu property of the TppDesignerWindow object and matching the
appropriate items by the caption?

--

Comments

  • edited November 2006
    Hi Chris,

    The designer toolbars and menus have been drastically changed for RB 10.x.
    Take a look at the following example on how to manipulate the various new
    components.

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

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Hi Tailor,

    Take a look in the example of the commented code accessing the file menu
    directly. Once you get access to the TppDesignFileMenu object, it is
    possible to add or remove items from the menu using the same method we use
    in our code. Take a look at the TppDesignFileMenu.CreateItems and
    TppDesignFileMenu.CreateControls routines located in the
    ppDesignLayoutMenu.pas file for an example of this.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2006
    Nico Cizik (Digital Metaphors) escreveu:
    Interesting ... I am looking for a similiar thing. I have a legacy
    application made by another person, and I trying to make it works with
    RB 10 (it was made with RB 6 or 7) If I can show/hide a menu item with
    that, I could simulate a click too. Can I apply something like this to
    call specific methods found on popup menus of the designer? Some options
    found that does not appear on the main menu.
  • edited December 2006
    Thanks Nico,

    I found a brute force way of accomplishing this, but the code that you
    provided is much cleaner.


  • edited December 2006
    That's OK, but if the option is not acessible in the Design menu ? There
    is options that only appears on a popup menu for the selected object.
    Can I do simulate in code a "rigth click, left clik on the xx option",
    that is, activating by code any option visible on the popup associated
    with an object of the report?

    Thanks.

    Nico Cizik (Digital Metaphors) escreveu:
  • edited December 2006
    Hi Tailor,

    If you take a look at the CreateControls routine as mentioned below, you
    will see that all the options are created and added when the menu is
    created. With the example, you have the ability to take complete control
    over the menu and customize it however you need, removing or adding hidden
    options.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.