Menus and Floating Windows

You can create and attach a menu bar to any floating window. The menu bar is created and maintained with the methods described in Menus Overview. Note that when a floating window is created, its menu, if present, is the only menu available as long as that floating window is the active window. Menus in other windows are disabled.

The library routine W$MENU is used to create and control the menu bar. When you call W$MENU, and the routine has to resolve which window to apply its actions to, it assumes the current window. With the following operations, you can specify a particular window by passing the target window's handle as a parameter in the position noted below.

WMENU-SHOW           --3rd parameter
WMENU-GET-HANDLE     --2nd parameter

If you have a floating window displayed, and you want to update the menu in the main application window, you must specify the handle of the main application window in the call to WMENU-SHOW. For example:

DISPLAY INITIAL WINDOW, HANDLE MAIN-WINDOW
PERFORM BUILD-MAIN-MENU
CALL "W$MENU" USING WMENU-SHOW, MENU-HANDLE
  .
  .
DISPLAY FLOATING WINDOW ...
  .
  .
PERFORM CHANGE-MAIN-MENU
CALL "W$MENU"
      USING WMENU-SHOW, MENU-HANDLE, MAIN-WINDOW
Note: Microsoft Windows does not display menus correctly in floating windows that have thick borders (that is, BOXED floating windows). As a matter of style, Windows applications never display menus in windows with this border type (this style is normally used for dialog boxes). If you want to put a menu in a floating window, you must not use the BOXED style when you create the window. For an example of a floating window with a menu, see the ACUCOBOL-GT debugger screen.