|
|
A menu is a collection of menu items, providing dynamic interface behavior and client-to-server communication with AJAX.
Menus may be hierarchical. A menu may contain menu_items, and a menu_item may contain
menu_items.
This menu has two menu items. They are arranged horizontally. When "QE2" is clicked, it calls method "serve_champagne" on the Water server. When "Titanic" is clicked, it calls method "sink" on the Water server. The upper left corner of this collection of menu items will appear at x,y location 0,0 on the browser.
biz.<menu layout=layout.<row/> > biz.<menu_item label="QE2" task=<serve_champagne/> /> biz.<menu_item label="Titanic" task=<sink/> /> </menu>
This menu provides several sub-options for the Titanic. It's arranged in a horizontal row, and sub-options will be arranged in horizontal rows starting below their parent. When the menu first appears it will look like example 1. However, when the user points at "Titanic" with their pointer, its child menu items will appear.
biz.<menu layout=layout.<row/> >
biz.<menu_item label="QE2" task=<serve_champagne/> />
biz.<menu_item label="Titanic" task=<sink/> >
biz.<menu_item label="Drown" task=<drown/> />
biz.<menu_item label="Take lifeboat" task=<take_lifeboat/> />
biz.<menu_item label="Sing sappy song" task=<sing/> />
</menu_item>
</menu> Using this general pattern, you can construct menus as many levels deep as you want to.
This is the same as example 1, but is positioned at x,y location 100,200 on the page. The layout
will use as its starting location the specified location of the off state of the first menu_item
in the menu. If that menu_item does not have a specified location of the off state, as in
example 1, the layout uses 0,0 instead.
biz.<menu layout=layout.<row/> > biz.<menu_item label="QE2" task=<serve_champagne/> off=<ui_view x=100 y=200/> /> biz.<menu_item label="Titanic" task=<sink/> /> </menu>
Another way to accomplish this is to specify the origin outright to the layout, as shown here:
biz.<menu layout=layout.<row origin_x=100 origin_y=200/> > biz.<menu_item label="QE2" task=<serve_champagne/> /> biz.<menu_item label="Titanic" task=<sink/> /> </menu>
© Copyright 2007 Clear Methods, Inc.