Example 2: Start menu created dynamically

MAIN
  DEFINE aui om.DomNode 
  DEFINE sm  om.DomNode 
  DEFINE smg om.DomNode 
  DEFINE smc om.DomNode 

  LET aui = ui.Interface.getRootNode()

  LET sm = aui.createChild("StartMenu")

  LET smg = createStartMenuGroup(sm,"Ordering")
  LET smc = createStartMenuCommand(smg,"Orders","fglrun orders.42r",NULL)
  LET smc = createStartMenuCommand(smg,"Customers","fglrun custs.42r",NULL)
  LET smc = createStartMenuCommand(smg,"Items","fglrun items.42r",NULL)
  LET smc = createStartMenuCommand(smg,"Reports","fglrun reports.42r",NULL)
  LET smg = createStartMenuGroup(sm,"Configuration")
  LET smc = createStartMenuCommand(smg,"Database","fglrun dbseconf.42r",NULL)
  LET smc = createStartMenuCommand(smg,"Users","fglrun userconf.42r",NULL)
  LET smc = createStartMenuCommand(smg,"Printers","fglrun prntconf.42r",NULL)

  MENU "Example"
    COMMAND "Quit"
      EXIT PROGRAM
  END MENU

END MAIN

FUNCTION createStartMenuGroup(p,t)
  DEFINE p om.DomNode 
  DEFINE t STRING
  DEFINE s om.DomNode 
  LET s = p.createChild("StartMenuGroup")
  CALL s.setAttribute("text",t)
  RETURN s 
END FUNCTION

FUNCTION createStartMenuCommand(p,t,c,i)
  DEFINE p om.DomNode 
  DEFINE t,c,i STRING
  DEFINE s om.DomNode 
  LET s = p.createChild("StartMenuCommand")
  CALL s.setAttribute("text",t)
  CALL s.setAttribute("exec",c)
  CALL s.setAttribute("image",i)
  RETURN s 
END FUNCTION