Contents page

Pop Up Menus


Pop Up Menus

Sometimes, it's nice to be able to activate a menu anywhere in the screen. For example, the user may click on a gadget, intending to change some parameter of it. A menu pops up right then and there and, since the mouse is positioned over it, the user can quickly select the desired option.

Pop Up Menus are very easy to use, especially if you are familiar with working with Intuition style Drop Down menus.

The only differences with Intuition style menus are:

As with Intuition Menus, you create your menu with Menu and MenuItem structures. See the Intuition programming guide for more on how to do that.

When you wish to open a Pop Up Menu, call PopUpMenu and pass it pointers to your Window and Menu structure. After it has put up the menu and the user has selected one or none of the items, it will return a selection code, which you can decipher with the Intuition ITEMNUM and SUBNUM macros. Note that there is no point in deciphering MENUNUM because there is only one Menu.

If a gadget is used to select your menu, make sure its highlight rendering is set to GADGHNONE. Otherwise, it will change as the mouse pointer moves over the menu, and when the menu is released, the section under the menu will not have changed, leaving an unsightly blemish. The loss of GADGHCOMP and GADGHBOX rendering is really no loss since you are now displaying the selection of your gadget with a Pop Up Menu.