Fixing the RAD Studio 10 Seattle & 10.1 Berlin IDE View menu with ToolsAPI

12 years ago, I did a project and wrote a blog post on enumerating the Delphi 8 IDE menu items.

Recently, I did a new one for the RAD Studio 10 Seattle IDE and RAD Studio 10.1 Berlin IDE. Why did I write one? It's to find out for myself what the IDE menus are, and then, extend it. Why? For too many years, the developers did not want to spend time to fix the issue where the View menu is way too long. I filed a bug, but I guess it was lost in time. A search for it found two similar bugs, QC 92248 and QC 101412.

 

The binaries are here on Embarcadero's CodeCentral.

 

Here's before and after for RS10 Seattle, followed by RS10.1 Berlin:

Before:

 

After:

Before:

After:

 

class procedure TDiscoverMenus.SubMenus(const AMenuItem: TMenuItem);
var
  LChildMenuItem: TMenuItem;
begin
  SL.Add(Format('Name: %s Caption: %s', [AMenuItem.Name, AMenuItem.Caption]));
  for LChildMenuItem in AMenuItem do
    begin
      if LChildMenuItem.Count>0 then
        SubMenus(LChildMenuItem) else
      SL.Add(Format('Name: %s Caption: %s', [LChildMenuItem.Name, LChildMenuItem.Caption]));
    end;
end;

class procedure TDiscoverMenus.EnumerateMenus;
var
  LMainMenu: TMainMenu;
  LINTAServices: INTAServices;
  LMenuItem: TMenuItem;
  LLine: string;
begin
  if Supports(BorlandIDEServices, INTAServices, LINTAServices) then
    begin
      LMainMenu := LINTAServices.MainMenu;
      SL := TStringList.Create;
      try
        for LMenuItem in LMainMenu.Items do
          SubMenus(LMenuItem);
        for LLine in SL do
          OutputDebugString(PChar(LLine));
      finally
        SL.Free;
      end;
    end;
end;
Published Sun, 1 May 2016 @ 12:49 PM by chuacw

Comments (Will be reviewed before being published)

# Nice :-)

Monday, May 02, 2016 6:10 AM by Ondrej Kelle

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Enter the following code to ensure that your comment reaches the intended party:
Enter the numbers you see in the image: