Menu
| 📊 Overview: 6 Properties | 1 Constructor | 7 Functions |
📝 Description
Creates a new menu with optional collection of text items that return their index when selected
🕐 Last updated: 2025-12-10T11:45:23.331Z
📑 Table of Contents
- 📋 Properties (6)
- 🏗️ Constructor (1 param)
- ⚙️ Functions
- Regular Functions
- addSeperator
- addVariantItem (2 params) →
$MenuItem : cs.MenuItem - addFormulaItem (2 params) →
$MenuItem : cs.MenuItem - addSubMenu (1 param) →
$Menu : cs.Menu - show →
$FormulaResult : Variant - _addMenuItems (1 param)
- _release
- Regular Functions
Properties
| Property | Type | Default | Description |
|---|---|---|---|
_MenuItems | Collection | - | Collection of MenuItem and submenu objects |
_MenuReference | Text | - | 4D menu reference handle |
_SubMenu | Boolean | - | True if this menu is a submenu of another |
_SubMenuText | Text | - | Display text when this is a submenu |
_MenuItemCollection | Collection | - | Flattened collection of all menu items including submenus |
Cancelled | Boolean | - | True if user cancelled menu selection |
Constructor
constructor
[🏗️ constructor]
Class constructor($BasicMenuItems : Collection)
Creates a new menu with optional collection of text items that return their index when selected
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$BasicMenuItems | Collection | - | - |
Functions
Regular Functions
addSeperator
Function addSeperator
Adds a separator line to the menu (ignored if menu is empty)
addVariantItem
Function addVariantItem($MenuText : Text; $Variant : Variant) -> $MenuItem : cs.MenuItem
Adds a menu item that returns a specified variant value when selected
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$MenuText | Text | - | - |
$Variant | Variant | - | - |
Returns: cs.MenuItem
addFormulaItem
Function addFormulaItem($MenuText : Text; $FormulaOrFormulaSet : Variant) -> $MenuItem : cs.MenuItem
Adds a menu item that executes a formula or formula set when selected
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$MenuText | Text | - | - |
$FormulaOrFormulaSet | Variant | - | - |
Returns: cs.MenuItem
addSubMenu
Function addSubMenu($SubMenuText : Text) -> $Menu : cs.Menu
Adds a submenu with the specified text, returns the new submenu for further item additions
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$SubMenuText | Text | - | - |
Returns: cs.Menu
show
Function show -> $FormulaResult : Variant
Displays the menu and returns the result from the selected item, sets Cancelled if dismissed
Returns: Variant
_addMenuItems
Function _addMenuItems($ParentMenuReference : Text)
Internal method to build 4D menu structure from menu items, handling submenus recursively
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
$ParentMenuReference | Text | - | - |
_release
Function _release
Releases menu resources, recursively releasing all submenus
Generated from Menu.4dm