Expand my Community achievements bar.

SOLVED

How to create a 3 or more level Popup menu

Avatar

Level 6

Hello,

I know how to create a 2-level menu for somehting like:

Fruits>Apple

          Banana

          Oranges

var choice = app.popUpMenuEx(

     {cName: "Fruits",

      oSubMenu: [ {cName: "Apple", cReturn: "Apple" }, {cName: "Banana", cReturn: "Banana" }, {cName: "Melon", cReturn: "Melon" } ]},

But what would the code look like for something like (3 level):

Fruits>Apple

          Banana

          Oranges>Navel

                        Valencia

                        Moro (Blood)

or even something like this (4-levels):

Location A......>Site A......>Properties...>Property1

                                                            Property2

                                                            Property3

                        Site B>

                        Site C>

Location B>

Location C>

So overall, how would the above script for a 2-level popup menu be modified for a 3, 4, or more level popup menu?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You can add the oSubMenu values at any level, so;

var choice = app.popUpMenuEx(

     {cName: "Fruits",

      oSubMenu: [ {cName: "Apple", cReturn: "Apple" },

                  {cName: "Banana", cReturn: "Banana" },

                  {cName: "Oranges",

                   oSubMenu: [ {cName: "Navel" },

                               {cName: "Valencia" },

                               {cName: "Moro (Blood)" } ] }

                ]

     });

console.println(choice.toSource());

Would give you the menu in your first example.  If the cReturn value is the same as the cName then you can just leave it off (as I have for th 3rd level menu).

Regards

Bruce

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

You can add the oSubMenu values at any level, so;

var choice = app.popUpMenuEx(

     {cName: "Fruits",

      oSubMenu: [ {cName: "Apple", cReturn: "Apple" },

                  {cName: "Banana", cReturn: "Banana" },

                  {cName: "Oranges",

                   oSubMenu: [ {cName: "Navel" },

                               {cName: "Valencia" },

                               {cName: "Moro (Blood)" } ] }

                ]

     });

console.println(choice.toSource());

Would give you the menu in your first example.  If the cReturn value is the same as the cName then you can just leave it off (as I have for th 3rd level menu).

Regards

Bruce

Avatar

Level 6

Thanks BR001! I appreciate your help.