The CW_PDMENU function simplifies creating widget pulldown menus. It has a simpler interface than the XPDMENU procedure, which it replaces. Events for the individual buttons are handled transparently, and a CW_PDMENU event returned. This event can return any one of the following:
Only buttons with textual names are handled by this widget. Bitmaps are not understood.
The returned value of this function is the widget ID of the newly-created pulldown menu widget.
This routine is written in the IDL language. Its source code can be found in the file
subdirectory of the IDL distribution.
An array of strings or structures. If Desc is an array of strings, each element contains the flag field, followed by a backslash character, followed by the name of the menu item, optionally followed by another backslash character and the name of an event-processing procedure for that element. A string element of the Desc array would look like:
is the flag field and
is the name of the menu item. The flag field is a bitmask that controls how the button is interpreted; appropriate values for the flag field are shown in
Button Flag Bit Meanings.
. If the
field is present, it is the name of an event-handling procedure for the menu element and all of its children.
The flags field is a bitmask that controls how the button is interpreted; appropriate values for the flag field are shown in Button Flag Bit Meanings. . Note that if Desc is an array of structures, you cannot specify individual event-handling procedures for each element.
This button is the last button at the current pulldown level. The next button belongs to the same level as the current parent button. If the name field is not specified (or is an empty string), no button is created, and the next button is created one level up in the hierarchy.
The name of the font to be used for the button titles. The font specified is a "device font" (an X Windows font on Motif systems; a TrueType or PostScript font on Windows or Macintosh systems). See for details on specifying names for device fonts. If this keyword is omitted, the default font is used.
If the MBAR keyword is set, and one of the buttons on the menubar has the label "help" (case insensitive) then that button is created with the /HELP keyword to give it any special appearance it is supposed to have on a menubar. For example, Motif expects help buttons to be on the right.
Set this keyword to create a menubar pulldown. If MBAR is set, Parent must be the menubar of a top-level base. (See the MBAR keyword to WIDGET_BASE for details.)
Set this keyword and the VALUE field of returned events will be the fully qualified name of the selected button. This means that the names of all the buttons from the topmost button of the pulldown menu to the selected one are concatenated with the delimiter specified by the DELIMITER keyword. For example, if the top button was named COLORS, the second level button was named BLUE, and the selected button was named LIGHT, the returned value would be
The widget ID returned by most compound widgets is actually the ID of the compound widget's base widget. This means that many keywords to the WIDGET_CONTROL and WIDGET_INFO routines that affect or return information on base widgets can be used with compound widgets.
The following is the description of a menu bar with two buttons, "Colors" and "Quit". Colors is a pulldown containing the colors "Red", "Green", Blue", "Cyan", and "Magenta". Blue is a sub-pulldown containing "Light", "Medium", "Dark", "Navy", and "Royal."
The Desc array could also have been defined using a structure for each element. The following array of structures creates the same menu as the array of strings shown above. Note, however, that if the Desc array is composed of structures, you cannot specify individual event-handling routines.