Disabling Menu Items

Your program may want to enable or disable individual menu entries dynamically. To do this, call W$MENU passing the WMENU-ENABLE or WMENU-DISABLE operation code. Follow this with the handle of the owning menu and the ID of the particular entry you want to change.

For example, to disable menu item 101, use:

CALL "W$MENU" USING WMENU-DISABLE, 
MENU-HANDLE, 101

If you enable or disable a menu item on the top level of the menu, you must use the WMENU-SHOW operation to make your change visible. This allows you to modify several top level items at once before re-displaying the menu.

For example, you might have:

CALL "W$MENU" USING WMENU-ENABLE, 
MENU-HANDLE, 101
CALL "W$MENU" USING WMENU-DISABLE,
MENU-HANDLE, 102
CALL "W$MENU" USING WMENU-SHOW, 
MENU-HANDLE