Creating the start menu dynamically
Start menu can be created dynamically with the om.DomNode
class.
First, get the abstract user interface root node:
DEFINE aui om.DomNode
LET aui = ui.Interface.getRootNode()
Next, create a node with the "
StartMenu
" tag name:
DEFINE sm om.DomNode
LET sm = aui.createChild("StartMenu")
Next, create a "
StartMenuGroup
" node to group a couple of command nodes:
DEFINE smg om.DomNode
LET smg = sm.createChild("StartMenuGroup")
CALL smg.setAttribute("text","Programs")
Then, create "
StartMenuCommand
" nodes for each program and, if needed, add
"StartMenuSeparator
" nodes to separate entries:
DEFINE smc, sms om.DomNode
LET smc = smg.createChild("StartMenuCommand")
CALL smc.setAttribute("text","Orders")
CALL smc.setAttribute("exec","fglrun orders.42r")
LET smc = smg.createChild("StartMenuCommand")
CALL smc.setAttribute("text","Customers")
CALL smc.setAttribute("exec","fglrun customers.42r")
LET sms = smg.createChild("StartMenuSeparator")
LET smc = smg.createChild("StartMenuCommand")
CALL smc.setAttribute("text","Items")
CALL smc.setAttribute("exec","fglrun items.42r")