RMB MenuState

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Programmer's Guide >

RMB MenuState

Starting from R26 this topic has replaced the .UIvbs implementation

Introducing MenuState to replace UIvbs

Starting from R26, a new mechanism has been introduced for managing the enable/disable state of custom RMB menu entries.
A new script named MenuState must be placed in the root folder of each type (AnyType, A, P, G, 0). The script should be named as follows:

AnyType → MenuState

P → MenuStateP

A → MenuStateA

D → MenuStateD

G → MenuStateG

0 → MenuState0

This script can be implemented in any of the supported languages (.vbs, .ps1, .py, .mwnet). Only one script per type is executed, regardless of the scripting language used. The script must output a list of keys in the form:

@SCRIPT_ENABLED=Create_drawing,1

@SCRIPT_ENABLED=ViewExcelPage,0
...

where the first part indicates the script name and the trailing value specifies whether the menu entry is enabled (1) or disabled (0). This behavior applies to all subfolders of the given type.

The advantage is that a single controlling script is executed instead of one per menu entry (UIvbs), significantly improving performance.

The MenuState mechanism has been extended to also support the following customization contexts:

1. Custom Menu Entries for Previous Revisions

The folder named AnyTypeRevisions is managed by MechWorks PDM and allows a generic script to be listed and executed through the Previous Revisions grid RMB popup menu available in the Tree Page.

It is possible to control the enable/disable state of these scripts by adding a corresponding MenuStateAnyTypeRevisions script in the same folder.

Example

LST\AnyTypeRevisions\MenuStateAnyTypeRevisions.ps1

This script can be implemented in any supported language and is executed once to determine the state of all the RMB entries in that folder.

2. Custom Query Grids Popup Menus

If custom query grids have been defined using the LST\OnCustomQueryTab_TabName.LST mechanism, it is possible to display an RMB Popup Menu when right-clicking a row in the corresponding Custom Query Grid.

Such popup menus are defined in the following structure:
LST\CustomQueryTabMenus\<TabName>\
and contain the scripts to be displayed as menu entries.

It is now possible to place a MenuState script named as follows: LST\CustomQueryTabMenus\<TabName>\MenuState<TabName>.xxx

Example

LST\CustomQueryTabMenus\MyCustomTab\MenuStateMyCustomTab.ps1

This script can be implemented in any supported language and is executed once to determine the state of all the RMB entries in that folder.

We suggest implementing these scripts in MWNET whenever possible, since compiled .NET execution is expected to be the most efficient.

Deprecation of UIvbs

The previous UIvbs mechanism for enabling/disabling menu entries is now deprecated. The MenuState approach provides faster execution and unified handling, even when using VBScript.