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

Changing menuitems in designer

edited September 2015 in General
Hi list,

we will have to deactivate some menuitems within the designer. Where
can this be don?

In former times(v5.56) thsi could be done in pPDsgner.dfm

Comments

  • edited September 2015
    You should be able to work it out from how I work with the Designer
    menus in this code:

    procedure TnxRBDesignerEngine.InitializeDesignerMenus;
    var
    lMenuBar : TppMenuBar;
    lFileMenu : TppTBCustomItem;
    lDesignerMenu : TppDesignerMenu;
    lDataFileMenu : TdaDataFileMenu;
    lCodeFileMenu : TraCodeManagerMenu;
    begin

    // each notebook page can have a menu bar, this returns the menu bar
    for the
    // active notebook page
    lMenuBar := Designer.Form.MainMenu;

    case Designer.Form.Notebook.ActivePageIndex of
    0 :
    begin

    lFileMenu := lMenuBar.Items[0];

    if (lFileMenu is TdaDataFileMenu) then
    begin
    lDataFileMenu := TdaDataFileMenu(lFileMenu);
    // lDataFileMenu.Close.Visible := DebugHook <> 0;
    lDataFileMenu.Close.Caption := 'Refresh Data Fields';
    lDataFileMenu.Close.OnClick := DoDataModuleFieldsRefresh;
    end;
    end;

    1 : if (lMenuBar is TraCodeManagerMenu) then
    begin
    lCodeFileMenu := TraCodeManagerMenu(lMenuBar);
    lCodeFileMenu.FileMenu.Close.Visible := False;
    end;

    2 : if (lMenuBar is TppDesignerMenu) then
    begin
    lDesignerMenu := TppDesignerMenu(lMenuBar);
    lDesignerMenu.FileMenu.Close.Visible := False;
    Designer.AllowSaveToFile := False;
    // lDesignerMenu.FileMenu.SaveToFile.Visible := False;
    // lDesignerMenu.FileMenu.LoadFromFile.Visible := False;
    lDesignerMenu.HelpMenu.visible := False;
    end;

    end;

    end;

  • edited September 2015
    Hi Carsten,

    In addition to Paul's code, the following article/example will also help
    you customize the Designer menu.

    http://www.digital-metaphors.com/rbWiki/End-User/Designer/How_To...Customize_Designer_Menu_and_Toolbars

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2015
    I have to admit that reading your wiki could somtimes answer questions
    before they are made :-)

    Nico Cizik (Digital Metaphors) schrieb am 24.09.2015 :
  • edited September 2015
    Solution works fine,

    except for
    - lDesignerMenu.FileMenu.SaveToFile
    - lDesignerMenu.FileMenu.LoadFromFile

    Neither setting visible nor changing caption works.

    Any ideas why?
    I make my changes in Form.OnCreate where a TppDesigner is placed within
    the form.

    Any known issues?

    Am 24.09.2015, Nico Cizik (Digital Metaphors) vermutete :
  • edited September 2015
    Hi Carsten,

    The SaveToFile and LoadFromFile options are initialized right when the
    file menu is clicked which is why your alterations are having no effect.

    You can hide/show these options using the Designer.AllowSaveToFile property.

    If you would like to alter the captions, I suggest using the language
    translation application as all captions are loaded from our language
    resource files. See more information in the \RBuilder\Language\..
    directory.

    Best Regards,

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