Bambookit Home    Bambookit GUI Tutorial

Back    Next   

II. GUI Basics

Chapter 6. Widgets - Using Widgets to Create Interfaces




Menu

setPopupAlign
setPopupRollover
setArrow

Menu Widget Menu widget consists of Listbox widget and Item widget.

XML Element Name

<Menu>
<Listbox>
<Item/>
<Item/>
<Item/>
</Listbox>
</Menu>

Example

By default the menu popups on the mouse click.
<Menu setLabel="Click me">
<Listbox setBorder="flat">
<Item setLabel="Item 1"/>
<Item setLabel="Item 2"/>
<Item setLabel="Item 3"/>
</Listbox>
</Menu>


Menu's properties

Basic set of methods that applies to all widgets and is applicable to Menu/Item is described in the Chapter 9 for widgets styles, and Chapter 10 for widgets attributes. For event handling methods please refer to Chapter 12.

The specific to the Menu properties are setPopupRollover, setPopupAlign, setArrow.

Method signature

setPopupRollover = "[bool]"
[bool] Valid values are true|false. The default is 'false'.

setPopupRollover is placed in the Menu element.

Examples

<Menu setLabel="Rollover me" setPopupRollover="true">
<Listbox setBorder="flat">
<Item setLabel="Item 1"/>
<Item setLabel="Item 2"/>
<Item setLabel="Item 3"/>
</Listbox>
</Menu>


Method signature

setPopupAlign = "[direction]"
[direction] valid values are: left | top | right | bottom | center The default alignment is centered (combobox alignment), If you wish to display the menu above the button then the alignment should be top (like windows start button) If you wish to display the menu to the right then the alignment should be set to the right (sub menu) setPopupAlign is placed in the Menu element.

Examples

In this example we will plase direction of the Menu to the 'top' setting setPopupAlign="top", and changing location of the menu to start from location '0,225' with width="60", and heigh="25"
<Menu setLabel="Start" setShape="0,220,60,25" setPopupAlign="top">
<Listbox setBorder="flat">
<Item setLabel="Item 1"/>
<Item setLabel="Item 2"/>
<Item setLabel="Item 3"/>
</Listbox>
</Menu>


Method signature

setArrow = "[0 | 1 | 2]"
Usually it set to '2' and used to set the 'right hand side' arrow for submenues [0 | 1 | 2] Valid values are 0 | 1 | 2.
0 - display no arrows 1 - display the combo box arrows 2 - display the 'right hand side' arrow (for submenus)
setArrow is placed in the Menu element.

Examples

The following example will demonstrate how to create a nested menus with setting 'arrows'. Place 'Menu' tag instead of 'Item' where you want the new menu to popup for this 'Item'. We set setBorder to 'none' in the Menu tag so it looks like another item.
<Menu setLabel="Start" setShape="0,220,60,25" setPopupAlign="top">
<Listbox setBorder="flat">
<Item setLabel="Item 1"/>
<Item setLabel="Item 2"/>
<Menu setLabel="Item 3" setBorder="none" setPopupAlign="right" setPopupRollover="true" setArrow="2">
<Listbox setBorder="flat">
<Item setLabel="Item 1"/>
<Item setLabel="Item 2"/>
<Item setLabel="Item 3"/>
<Item setLabel="Item 4"/>
</Listbox>
</Menu>
<Item setLabel="Item 4"/>
</Listbox>
</Menu>


Back    Next