Menu

Description

Specifies a menu. A menu is a widget which can be selected and focused.

XML-Tag

<menu>

Attributes

Attribute Domain Default Value Description
focusable boolean "true" Specifies if the element is focusable.
selectable boolean "true" Specifies if the element is selectable.
item_width size "100%" Specifies the width of an item in the menu.
item_height size "100%" Specifies the height of an item in the menu.
item_hmargin pixel "0" You can set an additional horizontal margin for each item.
item_vmargin pixel "0" You can set an additional vertical margin for each item.
cols number "0" The number of visible columns will be calculated based on the item_width attribute. If you want to have a specific number of columns (visible and invisible) you should set this cols attribute. If set to "0", the menu uses only visible columns.
fixed_pos number "-1" You can set a fixed position of the selected item. This works only for menus with cols="1" (vertical menu with single column) or menus with cols="9999" (horizontal menu with single row). The position 0 is the first item. If you set a value greater or equal than the number of visible items, the fixed selected item is in the middle. If you do not want a fixed position you should use fixed_pos="-1".
hloop boolean "false" If set to "true", you can press LEFT/RIGHT keys and the menu items will rotate horizontally without jumping out of the menu.
vloop boolean "false" If set to "true", you can press UP/DOWN keys and the menu items will rotate vertically without jumping out of the menu.
dim_items 0 - 255 "0" It is possible to dim out all menu items if the menu has not the focus. The value "255" means maximum dim-out.
dim_top 0 - 255 "0" Dim out items at the top of the menu. This works only for menus with fixed selection (see fixed_pos attribute). The value "255" means maximum dim-out.
dim_bottom 0 - 255 "0" Dim out items at the bottom of the menu. This works only for menus with fixed selection (see fixed_pos attribute). The value "255" means maximum dim-out.
dim_left 0 - 255 "0" Dim out items on the left of the menu. This works only for menus with fixed selection (see fixed_pos attribute). The value "255" means maximum dim-out.
dim_right 0 - 255 "0" Dim out items on the right of the menu. This works only for menus with fixed selection (see fixed_pos attribute). The value "255" means maximum dim-out.
trans_items 0 - 255 "0" It is possible to make all menu items transparent if the menu doesn't have the focus. The value "255" means maximum transparency.
trans_top 0 - 255 "0" Items at the top of the menu can be made transparent. This works only for menus with fixed selection (see fixed_pos attribute). The value "255" means maximum transparency.
trans_bottom 0 - 255 "0" Items at the bottom of the menu can be made transparent. This works only for menus with fixed selection (see fixed_pos attribute). The value "255" means maximum transparency.
trans_left 0 - 255 "0" Items on the left of the menu can be made transparent. This works only for menus with fixed selection (see fixed_pos attribute). The value "255" means maximum transparency.
trans_right 0 - 255 "0" Items on the right of the menu can be made transparent. This works only for menus with fixed selection (see fixed_pos attribute). The value "255" means maximum transparency.
zoomsel_width pixel "0" Selected items will be stretched horizontally by the given amount of pixels.
zoomsel_height pixel "0" Selected items will be stretched vertically by the given amount of pixels.
zoomsel_shiftx pixel "0" Selected items will be shifted horizontally by the given amount of pixels.
zoomsel_shifty pixel "0" Selected items will be shifted vertically by the given amount of pixels.
smooth_scrolling boolean "false" If set to "true" switching between menu items will be animated by a smooth movement into the right position.
selimage image "" Specifies the image to be used if the menuitem is selected. This image will be drawn on top of selbgimage.
Additionally all general and border attributes can be used.

Set an item template

The specific feature of the menu widget is that you can dynamically add and delete items. The layout of these items is free. Free means that you can use all widgets listed here (except <menu> itself) to build your own item template.

One requirement to the item template: The top-level widget must be selectable.

The examples below demonstrates how you can build different kind of menus.

Remarks

This element can be used as child within windows and widgets.

If you use <menuitem> the dialogmanager can add one or more menu items. For fixed menus you do not need to add it with usage of the C++ API.

Examples

Related elements

all windows and all widgets see here


<<< GUI-Reference