Menus on Menubars
Menu bar menus can contain any combination of the following types of menu items:
• Button menu item — Appears as a standard menu selection with an optional graphic to the left of its label. This is the only type of menu item that can have child <menuitem> elements.
• Menu separator — A line separating adjacent items.
• Toggle menu item — When activated, the item will display a check mark to the left of its label.
• Radio menu item — The menu item is displayed as a radio button.
Example 7. Sample menu bar
The following example creates a menu named Custom that contains the following menu items:
• A Find menu item that uses ACL to open the Find/Replace dialog box
• An Options menu with the following menu items:
◦ A Cut menu item that is disabled if no content in the document is selected. If content is selected, the Cut menu item becomes available and, when chosen, will cut the selected content to the clipboard.
◦ A Full Menus menu item that toggles the available Arbortext Editor menus between standard and full menus. Full Menus has a check mark next to it when enabled.
• A My ACL Function menu item that displays a response dialog box. This item is a template for inserting your own function.
<window width="150" height="40">
<menubar>
<menuitem label="Custom">
<menuitem label="Find" command="FindReplace"></menuitem>
<menuitem label="Options">
<menuitem label="Cut" shortcut="Ctrl+X" command="EditCut">
<script type="application/x-javascript" ev:event="menupost">
if (Application.activeDocument.textSelection.collapsed == true) {
Application.event.target.enabled=false;
}
else {
Application.event.target.enabled=true;
}</script>
</menuitem>
<menuitem label="Full Menus" type="toggle">
<script type="application/x-javascript" ev:event="menupost">
if (Application.getOption("fullmenus") == "on") {
Application.event.target.checked=true;
}
else {
Application.event.target.checked=false;
}
</script>
<script type="application/x-javascript" ev:event="menuselected">
if (Application.event.target.checked == true) {
Application.setOption("fullmenus", "off");
}
else {
Application.setOption("fullmenus", "on");
}
</script>
</menuitem>
</menuitem>
<menuitem label="-" type="separator">
</menuitem>
<menuitem label="My ACL function"
command="response('Put your ACL function call here')">
</menuitem>
</menuitem>
</menubar>
</window>