ui.Application.setApplicationMenu() accepts ui.MenuBar as a parameter and applies the start menu to the application.
Syntax
ui.Application.GetCurrent().setApplicationMenu(<ui.MenuBar>)
Arguments
<ui.MenuBar> |
the MenuBar object |
Usage and examples
MAIN
CALL ui.Application.GetCurrent().setAppType("container")
CALL ui.Application.GetCurrent().setMenuType("Tree")
CALL ui.Application.getCurrent().setApplicationMenu(createIuMenu())
MENU
ON ACTION my_action
DISPLAY "my_action"
ON ACTION exit
EXIT MENU
END MENU
END MAIN
FUNCTION createIuMenu()
DEFINE startmenu ui.MenuBar
DEFINE menugroup ui.MenuGroup
DEFINE menucommand ui.MenuCommand
DEFINE menubaritems DYNAMIC ARRAY OF ui.MenuItem
DEFINE menuEvent ui.BackgroundServerEventHandler
LET startmenu = ui.MenuBar.create("c1")
LET menugroup = ui.MenuGroup.create("MyMenuGroup")
CALL menugroup.setText("MenuGrouText")
LET menucommand = ui.MenuCommand.create("MyMenupCommand")
LET menuEvent = ui.BackgroundServerEventHandler.Create()
CALL menuEvent.SetCallBackAction("my_action")
CALL menucommand.SetOninvoke(menuEvent)
CALL menucommand.setText("menucommandText")
CALL menugroup.setMenuItems([menucommand])
LET menubaritems = startmenu.getMenuItems()
CALL menubaritems.insert(1, menugroup)
CALL startmenu.setMenuItems(menubaritems)
RETURN startmenu
END FUNCTION