Share

Interface: CuiMenu

Properties:

    .id : guid : Read

Gets the unique GUID id for this menu.

    .title : string : Read|Write

Gets/sets the title for this menu.

    .isFlat : boolean : Read|Write

Gets/sets whether the menu is displayed in flat style.

Using this option will omit the creation of a sub menu entry for this menu in the parent menu and will instead place all of its menu items directly into the parent menu.

    .parent : Interface : Read

Gets the parent menu for this menu, or undefined if there is no parent.

    .menuItems : Interface array : Read

Gets the array of menu items for this menu.

Methods:

    <boolean>Move <guid>parentMenuId beforeId:<guid>
       Move - no automatic redraw after invoked
       beforeId default value: "00000000-0000-0000-0000-000000000000"

Moves the menu to the position before the menu specified by beforeId, in the parent menu specified by parentMenuId.

    <Interface>CreateSubMenu <guid>id <string>title beforeId:<guid>
       CreateSubMenu - no automatic redraw after invoked
       beforeId default value: "00000000-0000-0000-0000-000000000000"

Creates a new sub menu item with the specified id and title, placed before the menu item specified by beforeId.

    <Interface>CreateAction <guid>id <integer>tableId <string>persistentActionId title:<string> beforeId:<guid>
       CreateAction - no automatic redraw after invoked
       title default value: undefined
       beforeId default value: "00000000-0000-0000-0000-000000000000"

Creates a new menu item with the specified id that calls the specified action item, and placed before the menu item specified by beforeId. The action item is specified by tableId and persistentActionId. If title is specified, it is used instead of the title specified by the action item. If no beforeId is specified, the new menu item will be appended in the parent menu. Returns a CuiActionMenuItem.

    <Interface>CreateMacroScriptAction <guid>id <string>macroScriptName <string>macroScriptCategory title:<string> beforeId:<guid>
       CreateMacroScriptAction - no automatic redraw after invoked
       title default value: undefined
       beforeId default value: "00000000-0000-0000-0000-000000000000"

Creates a macroScript-based menu item with the specified id, macroScriptName and macroScriptCategory. If title is specified, it is used instead of the button text provided by the macroScript action. If no beforeId is specified, the new menu item will be appended in the parent menu.

Example of referencing a macroScript:

    -- MacroScript action definition
    macroScript MenuAction1
        category:"Menu Demo"
        tooltip:"Menu Action 1 Description"
        ButtonText:"Menu Action 1"
    (
        ...
    )

    -- MacroScript menu item creation
    myMenu.CreateMacroScriptAction "0C4D0C3D-D870-476A-9CDD-B6ED35A580C0" "MenuAction1" "Menu Demo"
       CreateSeparator - no automatic redraw after invoked
       beforeId default value: "00000000-0000-0000-0000-000000000000"

Creates a menu separator and places it before the menu item specified by beforeId.

       DeleteItem - no automatic redraw after invoked

Deletes the menu item with the specified id.

       Popup - no automatic redraw after invoked
       applyUIScaling default value: true

Pops up (displays) the menu at the specified pos, optionally applying UI scaling if applyUIScaling is true.

Was this information helpful?