Index...
Centrallix Documentation
|
widget/menu
menu :: A visual pop-up or drop-down menu widget.
Metadata:
type: | widget/menu |
visual: | yes |
container: | no |
form element: | no |
Overview:
The menu widget is used to create popup menus, drop-down menus, and menu bars. Menu widgets consist of a series of menuitem widgets which compose a menu.
Menu items are generally linked to actions on a page via the use of connectors. Simply place the connector inside the menu item widget.
Note: as of the time of writing, menu widgets were not yet properly functional.
Usage:
Menus can be placed inside of any visual container. However, be aware that the menu will be clipped by its container, so placing them at the top-level can be of an advantage. Menu widgets contain menuitem widgets, which are also described in this section.
Properties:
Property | Type | Description |
background |
string |
A background image for the menu. |
bgcolor |
string |
A color, RGB or named, to be used as the menu's background. If neither bgcolor nor background are specified, the menu is transparent. |
fgcolor |
string |
A color for the menu's text. |
active_background |
string |
A background image for a menu item that is selected (clicked on) |
active_bgcolor |
string |
A color, RGB or named, to be used as a selected (clicked) item's background. If neither active_bgcolor nor active_background are specified, the 'highlight' color or background is used instead. |
highlight_background |
string |
A background image for a menu item that is highlighted (pointed at). |
highlight_bgcolor |
string |
A color, RGB or named, to be used as a highlighted (pointed-at) item's background. If neither highlight_bgcolor nor highlight_background are specified, the standard color or background is used instead. |
direction |
string |
Either "horizontal" or "vertical" (default), and determines whether the menu is a drop-down/popup (vertical) or a menubar (horizontal). |
popup |
yes/no |
Default "no". Popup menus disappear after an item on them is selected, whereas fixed menus remain visible (such as for menubars). |
row_height |
integer |
height, in pixels, of the menu items in a menu. |
height |
integer |
height, in pixels, of the menu, for menus with a direction of 'horizontal'. |
width |
integer |
width, in pixels, of the menu. For menus with a direction of 'vertical', an unspecified width is determined dynamically based on the menu contents. |
x |
integer |
x-coordinate of the upper left corner of the menu, relative to its container. |
y |
integer |
y-coordinate of the upper left corner of the menu, relative to its container. |
Child Properties:
(of widget/menuitem child widgets)
Property | Type | Description |
icon |
string |
Optionally, the pathname of an image file to display to the left of the menu item. |
checked |
yes/no |
Optionally, a checkbox can be displayed to the left of the menu item when 'checked' is specified. In this case, the 'value' can also be a runclient() expression that controls whether the menu item is checked. |
onright |
yes/no |
If set to "yes", then the menu item will be displayed on the righthand side of a horizontal menu bar (e.g., for having "File" "Edit" "Tools" on the left, and "Help" on the far right). |
label |
string |
The text to appear on the menu item. |
value |
string |
The 'value' of the menu item, passed to the Selected event, below. If not specified, it defaults to the name of the widget (not its label). |
(of widget/menusep child widgets)
none currently available
(of widget/menutitle child widgets)
Property | Type | Description |
label |
string |
The text to appear on the menu title. |
Actions:
Action | Description |
Activate |
This action causes a popup-type menu to become visible and appear at a selected (x,y) position on the page. When the user selects an item on the menu or clicks elsewhere on the page, the menu then disappears. Takes two parameters - X and Y, the (integer) positions on the page for the menu to appear. |
Events:
Event | Description |
Selected |
This event fires when a menu item is selected. It can be placed in the menu itself, or inside the menu item widget. When on a menu item, it only fires when that item is selected. When on a menu, it passes the selected item's value as a parameter named 'Item' (string). |
Sample Code:
$Version=2$
// Here's a sample menu with three buttons.
myMenu "widget/menu"
{
x = 10; y = 10; width = 72;
direction = "vertical"; popup = yes;
bgcolor="#808080";
m1 "widget/menuitem" { label="One"; }
m2 "widget/menuitem" { label="Two"; }
m3 "widget/menuitem" { label="Three"; }
}
Comments...
(none yet)
Add a Comment...
|