DialogEx

Far Manager

DialogEx

The DialogEx function shows a dialog with the possibility to assign a callback function for it.
int WINAPI DialogEx(
  int PluginNumber,
  int X1,
  int Y1,
  int X2,
  int Y2,
  const char *HelpTopic,
  struct FarDialogItem *Item,
  int ItemsNumber,
  DWORD Reserved,
  DWORD Flags,
  FARWINDOWPROC DlgProc,
  LONG_PTR Param
);

Parameters

PluginNumber
Plugin module number. It is passed to the plugin in the SetStartupInfo function
X1, Y1, X2, Y2
Dialog coordinates. You can specify them explicitly or use "Width x Height" formula - in this case both X1 and Y1 must be set to -1, while X2 and Y2 define dialog width and height respectively. In the latter case the dialog will be automatically centered on the screen. X2 and Y2 parameters can't be less than zero.
HelpTopic
Help topic for the dialog. If help is not needed, set this parameter to NULL.
Item
Address of an array of FarDialogItem structures. Each structure describes one dialog item.
ItemsNumber
Number of FarDialogItem array elements.
Reserved
Reserved for future use. Must be 0.
Flags
Set of flags, specifying additional dialog parameters. It can be a combination of the following values (FARDIALOGFLAGS enumeration):
FlagDescription
FDLG_WARNING Sets "Warning" color scheme for the dialog.
FDLG_SMALLDIALOG Allows to create dialogs with reduced border size. When drawing separators (DIF_SEPARATOR) for these dialogs it's assumed there's no space between dialog border and dialog double-line frame.
FDLG_NODRAWSHADOW Don't draw shadow under the dialog.
FDLG_NODRAWPANEL Don't draw dialog panel.
DlgProc
Pointer to the FARWINDOWPROC dialog callback function.
Param
Data that will be sent to the dialog callback function with the DN_INITDIALOG event.

Return value

The function returns either -1 when user cancels the dialog or the selected dialog item index (index of Item array element, it's emphasized in the example below).

Remarks

  1. FAR transforms Item elements to its own internal structure before creating a dialog. After dialog processing is over, Item elements array is adjusted according to the changes made in the progress of user work with the dialog.
  2. Starting from version 1.71 build 2451 "small" dialogs (FDLG_SMALLDIALOG flag) are drawn with a shadow. Set the FDLG_NODRAWSHADOW flag to suppress drawing a shadow for these dialogs.

Example

  int ExitCode=Info.DialogEx(Info.ModuleNumber,
                  -1,-1,76,10,
                  "TempCfg",DialogItems,
                  sizeof(DialogItems)/sizeof(DialogItems[0]),
                  0,0,
                  DlgProc,0);
  if (ExitCode != 7)
    return(FALSE);
See also: