|
| |
LoadMenu() Function
Loads and displays a popup menu from an external XML file. Syntax:
LoadMenu(url,tag,caption, action, image,default_image,separator)
Parameters:
| Parameter | Description
| | url | URL of an XML file to load menu from
| | tag | Defines XML tag encapsulating a menu item. Can be null.
| | caption | Defines an XML tag & parameter containing the menu item caption.
| | action | Defines an XML tag & parameter containing the menu item action to be executed when the item is selected.
| | image | Defines an XML tag & parameter containing menu item image or icon.
| | default_image | Defines a default menu item image or icon.
| | separator | Defines an XML Tag & parameter containing a menu separator.
|
Remarks:
- tag, caption,action and image parameters can define an XML tag, and optionally an XML parameter value. The syntax is tag:parameter.
- To create a separator, the separator tag in the XML needs to have a value. For example: <separator>1</separator>
Example:
Assume that the URL http://www.somedomain.com/menu.xml returns the following code:
<XML> <MENU> <ITEM> <OPTION name="Gif" command="SetText('<HTML>Gif Menu option selected</HTML>')"> </OPTION> <ICON>http://www.toolbarbrowser.com/img/smiley.ico</ICON> </ITEM> <ITEM> <SEPARATOR>1</SEPARATOR> <!-- Menu Separator--> </ITEM> <ITEM> <OPTION name="Jpeg" icon="GetSystemIcon('*.jpg')" command="SetText('<HTML>Jpeg Menu option Selected</HTML>') </OPTION> </ITEM> </MENU> </XML>
The command:
LoadMenu( 'http://www.somedomain.com/menu.xml', 'ITEM', 'OPTION:name', 'OPTION:command', 'ICON', NULL, 'SEPARATOR');
Can be used to load and display the menu defined in the above XML code.
Notes:
- ITEM defines the start of a menu item block. If menu items are not encapsulated, this parameter would be left blank.
- OPTION:name extracts the value of the name= parameter from the OPTION tag.
- OPTION:command extracts the value of the command= parameter from the OPTION tag.
- As no parameter is defined, the ICON extracts the value of the ICON tag.
|