Menus
(menus)
Overview
Menus
in Servoy provide a scripting object for creating and managing menus (JSMenu
, JSMenuItem
) in applications. These objects facilitate dynamic or design-time menu configuration and interaction.
The menus
object supports creating new menus using createMenu(name)
, where the name
must be a unique identifier. Existing menus can be retrieved using getMenu(name)
, returning null
if the specified menu does not exist. Additionally, all menus, whether created at runtime or design time, can be retrieved using getMenus()
, which returns an array of available menus.
Menus enable developers to customize user navigation and application functionality dynamically or statically, supporting enhanced application experiences.
Returned Types
Methods Summarized
Methods Detailed
createMenu(name)
Create a new, empty menu. Identifier must be unique among existing menus.
Parameters
String name the menu name (identifier)
Returns: JSMenu the newly created menu with the specified name.
Sample
var mnu = menus.createMenu('mymenu');
getMenu(name)
Gets a menu by name. Returns null if not found.
Parameters
String name the menu name (identifier)
Returns: JSMenu the menu with the specified name, or null if not found.
Sample
var mnu = menus.getMenu('mymenu');
getMenus()
Returns all the menus, either created at design time or at runtime.
Returns: Array an array of all menus, created either at design time or runtime.
Sample
var menus = menus.getMenus();
Last updated
Was this helpful?