DialogAddDynamicPulldown Function (Macro)

AMS 2.00 or higher dialogs.h

HANDLE DialogAddDynamicPulldown (HANDLE Handle, short flags, short x, short y, const char *label, Dialog_GetHandle_t GetPopup, unsigned short index);

Adds a dynamic pulldown menu into a dialog box.

DialogAddDynamicPulldown adds a pulldown item to the dialog box associated with the handle Handle at the position (x,y), where the coordinates are relative to the top-left corner of the dialog box.

When the pulldown is opened, the function passed to the GetPopup parameter is called (with the identification number of the newly created item as the value of the ID parameter), and it must return the handle of the actual popup menu (usually created using PopupNew). See menus.h for more information about creating popups.

An optional label label will appear in front of the request box; an empty string is used to indicate that no label should be drawn. The parameter index determines where the result value of executing the pulldown menu will be stored, and also indicates what the initially selected option will be. See DialogDo for information on how and where the result values are actually stored.

The order of item creation is very important, as it automatically gives each item an identification number (the first created item will get an identification number of 0, the second one will get 1, and so on). Every function that creates an item (i.e. every function beginning with 'DialogAdd...') will increase this identification number.

The parameter flags can be a combination of the following, defined in the DialogFlags enumeration:
DF_SCROLLABLE Set this flag if you want this item to be scrollable in a scroll region.
DF_SKIP This item is skipped when browsing through items with the arrow keys.
DF_SCREEN_SAVE The dialog code saves the area underneath the dialog box when it is started, DB_MEMFULL returned if it cannot. If you wish to use this flag, you must then set it with the first item you created in the dialog box.
DF_TAB_ELLIPSES Lines the item up on the right side of the dialog, and draws '......' between the item and its label. This flag is used in the TIOS 'MODE' dialog, for example. It is the default on AMS 1.xx.
DF_TAB_SPACES AMS 2.00 or higher: Like DF_TAB_ELLIPSES, but does not draw any dots.
DF_POPUP_RADIO AMS 2.00 or higher: If this flag is set, the item looks like a normal pulldown menu that you can select, but when you press the right arrow key, it does not pop up as usual, but returns control to the dialog callback function. This enables the programmer to do whatever he/she wants. For example, in the 'MODE' dialog, setting custom units pops up another dialog instead of a pulldown menu.

DialogAddDynamicPulldown returns H_NULL in case of an error, may return DB_MEMFULL if you used DF_SCREEN_SAVE, else returns Handle. This routine (as well as all other 'DialogAdd...' routines) may cause heap compression.

DialogAddDynamicPulldown is in fact a macro created for your convenience. It calls DialogAdd with D_DYNPOPUP as the ItemType parameter.


Uses: DialogAdd