[Main]
Name=DialogAddDynamicPulldown
Type=Function
Subtype=Macro
Header Files=dialogs.h
Definition=HANDLE DialogAddDynamicPulldown (HANDLE Handle, short flags, short x, short y, const char *label, Dialog_GetHandle_t GetPopup, unsigned short index);
Real Definition=#define DialogAddDynamicPulldown(h,f,x,y,l,g,i) DialogAdd ((h), (f), (x), (y), D_DYNPOPUP, (const char *) (l), (short *) (g), (short) (i))
MinAMS=2.00

[Description]
Adds a dynamic pulldown menu into a dialog box.

[Explanation]
DialogAddDynamicPulldown adds a pulldown item to the dialog box associated
with the handle <I>Handle</I> at the position (<I>x</I>,<I>y</I>), where the
coordinates are relative to the top-left corner of the dialog box.
<BR><BR>
When the pulldown is opened, the function passed to the <I>GetPopup</I>
parameter is called (with the identification number of the newly created item
as the value of the <I>ID</I> parameter), and it must return the handle of the
actual popup menu (usually created using
<A HREF="$$LINK(menus.h/PopupNew)">PopupNew</A>). See
<A HREF="$$LINK(menus.h/)">menus.h</A> for more information about creating
popups.
<BR><BR>
An optional label <I>label</I> will appear in front of the request box; an
empty string is used to indicate that no label should be drawn. The parameter
<I>index</I> determines where the result value of executing the pulldown menu
will be stored, and also indicates what the initially selected option will be.
See <A HREF="$$LINK(DialogDo)">DialogDo</A> for information on how and where
the result values are actually stored.
<BR><BR>
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.
<BR><BR>
The parameter <I>flags</I> can be a combination of the following, defined in
the <A HREF="$$LINK(DialogFlags)">DialogFlags</A> enumeration:
<TABLE BORDER CELLPADDING="3">
<TR>
  <TD>DF_SCROLLABLE</TD>
  <TD>Set this flag if you want this item to be scrollable in a scroll
      region.</TD>
</TR>
<TR>
  <TD>DF_SKIP</TD>
  <TD>This item is skipped when browsing through items with the arrow keys.</TD>
</TR>
<TR>
  <TD>DF_SCREEN_SAVE</TD>
  <TD>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.</TD>
</TR>
<TR>
  <TD>DF_TAB_ELLIPSES</TD>
  <TD>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.</TD>
</TR>
<TR>
  <TD>DF_TAB_SPACES</TD>
  <TD>AMS 2.00 or higher: Like DF_TAB_ELLIPSES, but does not draw any
      dots.</TD>
</TR>
<TR>
  <TD>DF_POPUP_RADIO</TD>
  <TD>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.</TD>
</TR>
</TABLE>
<BR>
DialogAddDynamicPulldown returns <A HREF="$$LINK(alloc.h/H_NULL)">H_NULL</A>
in case of an error, may return <A HREF="$$LINK(DialogMessages)">DB_MEMFULL</A>
if you used <A HREF="$$LINK(DialogFlags)">DF_SCREEN_SAVE</A>, else returns
<I>Handle</I>. This routine (as well as all other 'DialogAdd...' routines)
may cause heap compression.
<BR><BR>
DialogAddDynamicPulldown is in fact a macro created for your convenience.
It calls <A HREF="$$LINK(DialogAdd)">DialogAdd</A> with D_DYNPOPUP as the
<I>ItemType</I> parameter.

[References]
Out=DialogAdd
