Disabling an Entire Menu

You may want to prevent the user from having access to the menu during certain parts of your program. To do so, call W$MENU using the WMENU-BLOCK operation code. When you want to re-enable access, call W$MENU using WMENU-UNBLOCK.

Normally, you will want to do this when you must have some specific information from the user that you need in order to continue. By disabling the menu, you will prevent the user from trying to initiate a different operation that your program is not prepared to handle.

For example, if the user has clicked Open from the menu, you may want to disable the menu until you have retrieved the name of the file to open. This could be coded like this:

CALL "W$MENU" USING WMENU-BLOCK
PERFORM GET-FILE-NAME-FROM-USER
CALL "W$MENU" USING WMENU-UNBLOCK