Simple Popup Menus

The screen shots should be updated.

You can attach a popup menu (similar to the one that appears on RMB options) to an HTML element on your page using the method described below. First you must define your custom popup menu it in the preDefine() function.

popup = page.newASPPopup("test");
popup.addItem("Order Items","location='OrderItems.asp'");
popup.addItem("Msgbox","JavaScript:alert('Hi!')");
popup.addItem("test","change()");

Here we ask the ASPPage element to create a new instance of ASPPopup. We then add the corresponding commands for that popup menu using the method addItem(). The first parameter to this function is the text displayed in the popup menu, and the second is the client side action called by that command. When we execute define() with an already defined page in the page pool we need to fetch a reference to the above object.

popup = page.getASPPopup("test");

In the print content HTML section a call to ASPPopup.generateCall() will generate the popup menu.

appendToHTML("<a href=\""popup.generateCall()"\">Example popup</a>");

 

Hierarchical popup menus

Menus can have several levels. To add a submenu to a menu, use one of the ASPPopup.addSubmenu() calls. The submenu is a regular menu, with one exception; you must call the ASPPopup.setSubmenu() method.

An example:

pop = page.newASPPopup("test1");

pop2 = page.newASPPopup("test2");
pop2.addItem("Menu 2","");
pop2.setSubmenu();

pop3 = page.newASPPopup("test3");
pop3.addItem("Menu 3","");
pop3.setSubmenu();

pop2.addSubmenu("To menu 3",pop3);

pop.addSubmenu("To menu 2",pop2);

A submenu can also be used in several addSubmenu() calls.

Note that menus are normally not used directly. So this applies mostly to completely customized pages.

Adding icons to popup menus

You can simply add an icon to the popup menu items by adding an extra image url parameter to the addItem() method. The recommended size for any popup icon is 16px by 16px, as this would not effect the size of the defined popup menu rows. The syntax for adding such icons is as followed;

ASPPopup popup = newASPPopup("Menu");
popup.addItem("High16x16.gif", "High Priority","javascript:setPriority(0);");
popup.addItem("Normal Priority","javascript:setPriority(1);");
popup.addItem("Low16x16.gif","Low Priority","javascript:setPriority(2);");

and the result looks as follows,