| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > PopupClass > PopupClass Methods >====== AddSubMenu (add submenu) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[addmenu add a menu .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[ask display the popup menu .htm|{{btn_next_n.gif|Next page}}]] | | || **AddSubMenu( **[//text//]// ,selections, name to follow //**)** {{blk2blue.jpg|blk2blue.jpg}} | **AddSubMenu** | Adds a submenu to an existing menu. | | //text// | A string constant, variable, EQUATE, or expression containing the submenu text. If omitted, the submenu text must be prepended to the //selections //parameter. | | //selections// | A string constant, variable, EQUATE, or expression containing the text for the submenu items. The submenu items must be preceded by a double open curly brace ({{) and followed by a single close curly brace (}). | | //name to follow// | A string constant, variable, EQUATE, or expression containing the menu name or item name after which to insert the submenu. | The **AddSubMenu **method adds a submenu to an existing menu. The AddSubMenu method adds a submenu and its items, including a unique name for each item specified by the //selections //parameter. The //selections //parameter is identical to the submenu section of the //selections //parameter for the POPUP command. See //POPUP //in the //Language Reference// for more information. You set the action taken for each menu item with the AddItemMimic or AddItemEvent methods, or with your own custom code. These methods (and your code) must refer to the menu items by name (not by text). **Implementation:** The Ask method displays the popup menu and returns the selected item's name. The Popup class object derives the menu item name from its text. Each derived item name is the same as its text minus any special characters. That is, the name contains only characters 'A-Z', 'a-z', and '0-9'. If the resulting name is not unique, the PopupClass appends a sequence number to the name to make it unique. The //text// parameter accepts up to 1,024 characters; the //selections //parameter accepts up to 10,000 characters. **Example:** **MenuChoices EQUATE('&Insert|&Change|&Delete') !declare menu definition string** **SubChoices EQUATE('{{by &name|by &ZIP code}') !declare submenu definition** ** CODE** ** PopupMgr.AddMenu(MenuChoices)                    !add Popup menu** ** PopupMgr.AddSubMenu('&Print',SubChoices,'Delete')!add Print submenu after delete** ** CASE PopupMgr.Ask()                              !display popup menu** ** OF ('Insert')   ;DO Update(1)                    !process end user choice** ** OF ('Change')   ;DO Update(2)                    !process end user choice** ** OF ('Delete')   ;DO Update(3)                    !process end user choice** ** OF ('byname')   ;DO PrintByName                  !process end user choice** ** OF ('byZIPcode')  ;DO PrintByZIP                 !process end user choice** ** END** **See Also:     **[[additemevent set menu item action .htm|AddItemEvent]], [[additemmimic tie menu item to a button .htm|AddItemMimic]], [[addmenu add a menu .htm|AddMenu]], [[ask display the popup menu .htm|Ask]]