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

JSMenu,JSMenuItem,

Methods Summarized

Type
Name
Summary

Create a new, empty menu.

Gets a menu by name.

Returns all the menus, either created at design time or at runtime.

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

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

Sample

var mnu = menus.getMenu('mymenu');

getMenus()

Returns all the menus, either created at design time or at runtime.

Returns: Array

Sample

var menus = menus.getMenus();

Last updated