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

Control of the ReportTree popup menu in RB 17 & RB 19

Hello,

some time ago I've reported a problem in the old newsgroup, which was imported into this forum and closed:
http://www.digital-metaphors.com/forums/discussion/7017/control-of-the-reporttree-popup-menu-in-rb-17

I don't remember what happened afterwards and can't figure out anymore, whether I sent you the requested e-mail or not. I think I did, but not sure.

I believe in the past there was a wiki article about this, but now I can't see there anything the reporttree.

Since the other topic is closed and the issue still exists (back then I was testing it with RB 17.01 on XE7, but it's the same with RB 19.02 trial as well), I'm posting this one (maybe they can be merged and re-opened):
---------------------------------
apparently something has changed in one of the later versions regarding the control of the popup menu of ReportTree(window).

In the past I was hidding some menu items by

...
lLayoutManager := myDesigner.Form.LayoutManager;
lToolManager := lLayoutManager.ToolManager;
lReportTree := TppReportTreeWindow(lToolManager.ToolWindows.ItemsByName['NewReportTreeWindow']);
if lReportTree <> nil then begin
   lReportTree.SetInspectorVisible(false);
   lReportTree.ReportTree.ReadOnly := true;
   lReportTree.PopupMenu.OnPopup := myEventhandler_ReportTree_PopupMenu_Popup;
end;
...

procedure myEventhandler_ReportTree_PopupMenu_Popup(Sender: TObject);
var
   lLayoutManager: TppDesignLayoutManager;
   lToolManager: TppDesignToolManager;
   lReportTRee: TppReportTreeWindow;
   i: integer;
begin
   inherited;

   if Sender is TppTBXPopupMenu then begin
      if TppTBXPopupMenu(Sender).Items.Count > 0 then begin
         for i := 0 to TppTBXPopupMenu(Sender).Items.Count - 1 do begin
            if TppTBXPopupMenu(Sender).Items[i].Name = 'mniObjectInspector' then
               TppTBXPopupMenu(Sender).Items[i].Visible := false
            end
            ...
            else if TppTBXPopupMenu(Sender).Items[i].Name = 'mniDelete' then begin
               TppTBXPopupMenu(Sender).Items[i].Enabled := true;

               lLayoutManager := myDesigner.Form.LayoutManager;
               lToolManager := lLayoutManager.ToolManager;
               lReportTRee := TppReportTreeWindow(lToolManager.ToolWindows.ItemsByName['NewReportTreeWindow']);

               if lReportTree <> nil then begin
                  if lReportTree.SelectedComponent is TppVariable then begin
                     TppTBXPopupMenu(Sender).Items[i].Enabled := false;
                  end;
               end;
            end;
         end;
      end;
   end;
end;
Now it seems not to work anymore, as the name property of all the menu items is empty (caption is set, but can vary due to language), so that the complete menu is visible...

Also the ReportTree isn't ReadOnly anymore, although I set that property to true above etc.

How can I control the menu items of the ReportTree (and other parts, if they changed as well)?
---------------------------------
Best regards,
Mark
Sign In or Register to comment.