Summary:
The StartMenu defines a tree of commands that start programs on the application server where the runtime system executes.
<StartMenu [ startmenu-attribute="value"
[...] ] >
group
[...]
</StartMenu>
where group is:
<StartMenuGroup group-attribute="value" [...]>
{ <StartMenuSeparator/>
| <StartMenuCommand command-attribute="value" [...] />
| group
} [...]
</StartMenuGroup>
StartMenu node can only hold StartMenuGroup children.StartMenu. See below for more details.StartMenuGroup node can hold StartMenuSeparator, StartMenuGroup, or
StartMenuCommand children.StartMenuCommand. See below for more details.StartMenuCommand node defines a leaf of the StartMenu tree that can be selected to start a
program.StartMenuGroup. See below for more details.It is recommended that you create a specific BDL program dedicated to running the Start Menu. This program must create (or load) a Start Menu, and then perform an interactive instruction to enter the interaction loop.
The StartMenu must be defined in the Abstract User Interface tree using the DOM API, under the "UserInterface" root node.
The StartMenu is unique for a program and cannot be redefined.
When a StartMenu command is selected by the user, the runtime system automatically starts a child process with the command specified in the command attribute.Note that the DOM tag names are case sensitive; Startmenu is different from StartMenu.
The following table shows the attributes of the StartMenu node:
| Attribute | Type | Description |
| name | STRING | Identifies the StartMenu, can be omitted. |
| text | STRING | Defines the text to be displayed as title. |
The following table shows the attributes of the StartMenuGroup node:
| Attribute | Type | Description |
| disabled | INTEGER | Indicates if the group must be disabled (grayed, cannot be selected). |
| hidden | INTEGER | Indicates if the group is hidden or visible. |
| image | STRING | Defines the icon to be used for this group. |
| name | STRING | Identifies the start menu group, can be omitted. |
| text | STRING | Defines the text to be displayed for this group. |
The following table shows the attributes of the StartMenuCommand node:
| Attribute | Type | Description |
| disabled | INTEGER | Indicates if the item must be disabled (grayed, cannot be selected). |
| comment | STRING | Specifies the comment to be shown for this command. |
| exec | STRING | Defines the command to be executed when the user selects this command. |
| hidden | INTEGER | Indicates if the command is hidden or visible. |
| image | STRING | Defines the icon to be used for this command. |
| name | STRING | Identifies the StartMenu item, can be omitted. |
| text | STRING | Defines the text to be displayed for this command. |
| waiting | INTEGER | Defines if the command must be started without waiting (0, default) or waiting (1). |
The following table shows the attributes of the StartMenuSeparator node:
| Attribute | Type | Description |
| name | STRING | Identifies the StartMenu separator, can be omitted. |
To load a StartMenu definition file, use the utility method provided by the Interface built-in class:
01 CALL ui.Interface.loadStartMenu("standard")
This method accepts a filename with or without the "4sm" extension. If you omit the file
extension (recommended), the runtime system adds the extension automatically. If the file does not exist in the current
directory, it is searched in the directories defined in the DBPATH/FGLRESOURCEPATH environment variable.
You can create a StartMenu dynamically with the DomNode class:
First, get the AUI root node:
01DEFINE aui om.DomNode02LET aui = ui.Interface.getRootNode()
Next, create a node with the "StartMenu" tag name:
01DEFINE sm om.DomNode02LET sm = aui.createChild("StartMenu")
Next, create a "StartMenuGroup" node to group a couple of command nodes:
01DEFINE smg om.DomNode02LET smg = sm.createChild("StartMenuGroup")03CALL smg.setAttribute("text","Programs")
Then, create "StartMenuCommand" nodes for each program and, if needed, add "StartMenuSeparator"
nodes to separate entries:
01DEFINE smc, sms om.DomNode02LET smc = smg.createChild("StartMenuCommand")03CALL smc.setAttribute("text","Orders")04CALL smc.setAttribute("exec","fglrun orders.42r")05LET smc = smg.createChild("StartMenuCommand")06CALL smc.setAttribute("text","Customers")07CALL smc.setAttribute("exec","fglrun customers.42r")08LET sms = smg.createChild("StartMenuSeparator")09LET smc = smg.createChild("StartMenuCommand")10CALL smc.setAttribute("text","Items")11CALL smc.setAttribute("exec","fglrun items.42r")
01<StartMenu>02<StartMenuGroup text="Ordering" >03<StartMenuCommand text="Orders" exec="fglrun orders.42r" disabled="1" />04<StartMenuCommand text="Customers" exec="fglrun custs.42r" image="smiley" />05<StartMenuCommand text="Items" exec="fglrun items.42r" waiting="1" />06<StartMenuCommand text="Reports" exec="fglrun reports.42r" comment="Run reports" />07</StartMenuGroup>08<StartMenuGroup text="Configuration" >09<StartMenuCommand text="Database" exec="fglrun dbseconf.42r" />10<StartMenuCommand text="Users" exec="fglrun userconf.42r" />11<StartMenuCommand text="Printers" exec="fglrun prntconf.42r" />12</StartMenuGroup>13</StartMenu>
01MAIN02DEFINE aui om.DomNode03DEFINE sm om.DomNode04DEFINE smg om.DomNode05DEFINE smc om.DomNode0607LET aui = ui.Interface.getRootNode()0809LET sm = aui.createChild("StartMenu")1011LET smg = createStartMenuGroup(sm,"Ordering")13LET smc = createStartMenuCommand(smg,"Orders","fglrun orders.42r",NULL)14LET smc = createStartMenuCommand(smg,"Customers","fglrun custs.42r",NULL)15LET smc = createStartMenuCommand(smg,"Items","fglrun items.42r",NULL)16LET smc = createStartMenuCommand(smg,"Reports","fglrun reports.42r",NULL)17LET smg = createStartMenuGroup(sm,"Configuration")18LET smc = createStartMenuCommand(smg,"Database","fglrun dbseconf.42r",NULL)19LET smc = createStartMenuCommand(smg,"Users","fglrun userconf.42r",NULL)20LET smc = createStartMenuCommand(smg,"Printers","fglrun prntconf.42r",NULL)2122MENU "Example"23COMMAND "Quit"24EXIT PROGRAM25END MENU2627END MAIN2829FUNCTION createStartMenuGroup(p,t)30DEFINE p om.DomNode31DEFINE t STRING32DEFINE s om.DomNode33LET s = p.createChild("StartMenuGroup")34CALL s.setAttribute("text",t)35RETURN s36END FUNCTION3738FUNCTION createStartMenuCommand(p,t,c,i)39DEFINE p om.DomNode40DEFINE t,c,i STRING41DEFINE s om.DomNode42LET s = p.createChild("StartMenuCommand")43CALL s.setAttribute("text",t)44CALL s.setAttribute("exec",c)45CALL s.setAttribute("image",i)46RETURN s47END FUNCTION