| Allegro CL version 10.0 Moderately revised from 9.0. 9.0 version |
Arguments: window menu
Called whenever a menu is about to be made visible. window is the owning window. menu is the menu about to be displayed.
The default method calls about-to-show-menu recursively on the selected child of window. An application may add methods to this generic function in order to modify a menu that is about to be shown, making it suitable for the current context. This is most useful for pull-down menus, since they are not invoked by application code that could otherwise modify the menu before invoking it. You might, for example, want to make certain menu-items unavailable when the menu is displayed because the items are not meaningful in the current environment. The menu command Cut should typically be unavailable when nothing is selected, for example.
See cg-events.htm for information about event handling in Common Graphics. See also the menu chapter in the IDE User Guide, which has examples using this function.
If you run on the Ubuntu version of Linux, you will probably notice that about-to-show-menu does not get called for pull-down menus. The reason is that GTK on Ubuntu is not sending the usual GTK message that notifies CG that a menu is being shown, and so CG has no way of calling about-to-show-menu at that time. This is likely related to GTK modifications that Ubuntu appears to have made to shift menu bars onto title bars, though the problem persists if you select the Ubuntu option to show menus "in the window's toolbar" (actually in its title bar) rather than the default option to show them "in the menu bar" (actually in the main window's title bar). In any case, to support the Ubuntu platform you would need to move any code that you might otherwise have in about-to-show-menu methods to other places where code might be changing something that affects what should later be shown in pull-down menus.
Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page has had moderate revisions compared to the 9.0 page.
Created 2019.8.20.
| Allegro CL version 10.0 Moderately revised from 9.0. 9.0 version |