How PB realizes the creation of dynamic menu
PB The steps to dynamically create a menu are as follows: 1. Create a template menu (m_template) 2.a) Create a function to dynamically add a menu item in the template menu:/* = = = = = = = = = = = = = = = = = = = = = = = = = = Function name: of _ add memo Description: Add a template menu item parameter to the specified menu: String as_tag (tag for creating menu item) Return value: succeeded1= = = = = = = = = = = = = = = = = = = = = = = = = = = = lm _ item m = create m _ template lm _ item . text = as _ text lm _ item . tag = as _ tag Li _ item count = upper bound(am _ menu . item[])Li _ item count = Li _ item count+ 1am _ menu。 item[Li _ item count]= lm _ item return 1b, Function for creating pop-up menu in template menu/* = = = = = = = = = = = = = = = = = = = = = = = = = Function name: of _ popmemeu Description: specified menu parameter: menu am _ menu(popup menu). Integer ai _ x (popup menu) Integer ai _ y (y coordinate of pop-up menu) Return value: none = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =/ Am _ memu. pop menu(Ai _ x, Ai_y) In order to create multiple menu items at once, Define the function f _ dynamic _ menuitem ()/* = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = (Add the name of the menu item) Integer AI _ Integer ai_y (y coordinate of the pop-up menu) = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Integer Li _ item im _ template lm _ dynamic _ menu Li _ item count = upper bound(as _ menu[])for I = 1 to Li _ itemcountlm _ dynamic _ menu . of _ additem(lm _ menu,as_menu[i],string(I))nextlm _ dynamic _ menu . of _ pop menu