Menus#
The API used to create and control context/pop-up menus is detailed below.
Functions#
- eg-overlay-ui.menu_item()#
Create a new
uimenuitem
- Return type:
Version History
Version
Notes
0.0.1
Added
Classes#
- class eg-overlay-ui.uimenu#
A pop-up menu. The only children a popup menu can have are
uimenuitem
- add_item(menuitem)#
Add a
uimenuitem
to this menu.- Parameters:
menuitem (
uimenuitem
)
Version History
Version
Notes
0.0.1
Added
- show(x, y)#
Show the menu at the given coordinates. Typically this will be the mouse position. See
eg-overlay-ui.mouseposition()
Version History
Version
Notes
0.0.1
Added
- hide()#
Hide this menu. If this menu is a child of another menu that menu will also be hidden.
Version History
Version
Notes
0.0.1
Added
- class eg-overlay-ui.uimenuitem#
A menu item. A menu item can only be added to a
uimenu
- set_child(element)#
Set the child of this menu item. Any UI element can be used. This can also be a layout container to use multiple elements.
- Parameters:
element (
uielement
)
Version History
Version
Notes
0.0.1
Added
- set_pre(element)#
Set the ‘pre’ element, which is shown to the left of the child element. This should be a single UI element and is intended to add elements such as a checkbox or icon to a menu item.
- Parameters:
element (
uielement
)
Version History
Version
Notes
0.0.1
Added
- set_submenu(menu)#
Set a menu to be shown when this menu item has the mouse over it.
- Parameters:
menu (
uimenu
)
Version History
Version
Notes
0.0.1
Added
- enabled([value])#
Get or set wether this menu item is enabled or not. A disabled menu item does not react to mouse hover or click events.
- Parameters:
value (
boolean
) – (Optional)If present, sets if the menu item is enabled or not. If omitted, returns the current value.- Return type:
Version History
Version
Notes
0.0.1
Added
- addeventhandler(func)#
Add an event handler for this UI element. See UI Events.
- Parameters:
func (
function
)- Return type:
- Returns:
A id that can be used with
removeeventhandler()
Version History
Version
Notes
0.1.0
Added