Skip to main content
Inspiring
May 7, 2018
Answered

Custom submenu

  • May 7, 2018
  • 2 replies
  • 935 views

The code snippet below will place a new menu title "Automatic " after the "Help" menu in the Bridge main menu bar.

How can modify the snippet to add a submenu category with options:

For example:

Automatic

-- Category

---- Submenu 1

---- Submenu 2

---- Submenu 3

#target bridge    

   if( BridgeTalk.appName == "bridge" ) {  

      newMenu = new MenuElement( "menu", "Automatic", "after Help", "myMenu" ); 

      RPP = new MenuElement( "command", "Menu Title", "at the end of myMenu","myAlert"  );  

      }; 

 

RPP.onSelect = function () {  

runMyScript(); 

function runMyScript(){ 

//add your code here 

}

This topic has been closed for replies.
Correct answer SuperMerlin

Please try this...

#target bridge   

   if( BridgeTalk.appName == "bridge" ) { 

       //top menu

     newMenu = new MenuElement( "menu", "Automatic", "after Help", "myMenu" );

     //sub menu

     newMenu2 = new MenuElement( "menu", "Category", "at the beginning of myMenu", "myMenu2" );

      //sub menu

     newMenu3 = new MenuElement( "menu", "Category II", "at the end of myMenu", "myMenu3" );

      //menu items for Category

      RPP = new MenuElement( "command", "Menu Title", "at the end of myMenu2"); 

      RPP2 = new MenuElement( "command", "Menu Title II", "at the end of myMenu2"); 

      RPP3 = new MenuElement( "command", "Menu Title III", "at the end of myMenu2"); 

      //menu items for Category II

      XPP = new MenuElement( "command", "Title 1", "at the end of myMenu3");

      XPP2 = new MenuElement( "command", "Title 2", "at the end of myMenu3");

      XPP3 = new MenuElement( "command", "Title 3", "at the end of myMenu3");

      }; 

2 replies

Inspiring
May 7, 2018

Thank you again, it works great!

SuperMerlin
SuperMerlinCorrect answer
Inspiring
May 7, 2018

Please try this...

#target bridge   

   if( BridgeTalk.appName == "bridge" ) { 

       //top menu

     newMenu = new MenuElement( "menu", "Automatic", "after Help", "myMenu" );

     //sub menu

     newMenu2 = new MenuElement( "menu", "Category", "at the beginning of myMenu", "myMenu2" );

      //sub menu

     newMenu3 = new MenuElement( "menu", "Category II", "at the end of myMenu", "myMenu3" );

      //menu items for Category

      RPP = new MenuElement( "command", "Menu Title", "at the end of myMenu2"); 

      RPP2 = new MenuElement( "command", "Menu Title II", "at the end of myMenu2"); 

      RPP3 = new MenuElement( "command", "Menu Title III", "at the end of myMenu2"); 

      //menu items for Category II

      XPP = new MenuElement( "command", "Title 1", "at the end of myMenu3");

      XPP2 = new MenuElement( "command", "Title 2", "at the end of myMenu3");

      XPP3 = new MenuElement( "command", "Title 3", "at the end of myMenu3");

      };