Product Documentation
Virtuoso Layout Suite SKILL Reference
Product Version IC23.1, November 2023

mbRegisterCustomMenu

mbRegisterCustomMenu(
t_viewType
t_uniqueId
t_enableCB
t_customCB
)
=> t / nil

Description

Registers a custom menu with the menu builder for future retrieval and use within menus. A custom menu item is a single or slider menu that is built using the hi function calls, independently of the menu builder. The t_customCB argument is used to specify the function that is responsible for building and returning the menu item. The menu will display only when the mbSetContextData function is called.

Arguments

t_viewType

Name of the view type for which this action has been registered.

t_uniqueId

Unique ID for the reference custom menu.

t_enableCB

Function to determine if action is enabled or disabled.

t_customCB

Function to return the menu item or the slider menu item.

Values Returned

t

Returned when the custom menu is successfully registered.

nil

Returned when registration of the custom menu fails.

Example

Here, the first function, BuildCustMenuItem() creates a pulldown menu, and returns a slider menu containing it. The second function EnableCustMenuItem() returns t to ensure that the menu item is always enabled .

procedure(BuildCustMenuItem()
    hiCreatePulldownMenu(
      'MyCustomMenu
      "Custom Menu"
      list(
 hiCreateMenuItem(
   ?name 'item1
   ?itemText "Item 1"
   ?callback "println(\"Item 1\")"
 )
 hiCreateMenuItem(
   ?name 'item2
   ?itemText "Item 2"
   ?callback "println(\"Item 2\")"
 )
      )
    )
    hiCreateSliderMenuItem(
      ?name 'MySlider
      ?itemText "Custom Menu"
      ?subMenu MyCustomMenu
    )
  )
  procedure(EnableCustMenuItem()
    t
  )
  mbRegisterCustomMenu("maskLayout" "custMenu" "EnableCustMenuItem()"
"BuildCustMenuItem()")
  mbSetContextData("maskLayout" "custMenu" "Via Ruler" "Canvas" "Common")

Returns t.


Return to top
 ⠀
X