FarDialogItem

Far Manager

FarDialogItem

The FarDialogItem structure describes one dialog item. An array of those structures is passed to the Dialog or DialogEx functions to show a dialog.
struct FarDialogItem
{
  int Type;
  int X1;
  int Y1;
  int X2;
  int Y2;
  int Focus;
  union
  {
    DWORD_PTR Reserved;
    int Selected;
    const char *History;
    const char *Mask;
    struct FarList *ListItems;
    int  ListPos;
    CHAR_INFO *VBuf;
  }
#ifdef _FAR_NO_NAMELESS_UNIONS
  Param
#endif
  ;
  DWORD Flags;
  int DefaultButton;
  union
  {
    char Data[512];
    struct
    {
      DWORD PtrFlags;
      int   PtrLength;
      char *PtrData;
      char  PtrTail[1];
    } Ptr;
  }
#ifdef _FAR_NO_NAMELESS_UNIONS
  Data
#endif
  ;
};

Members

Type
Dialog item type. Can be one of the following values, described in the "Dialog items" topic.
X1,Y1,X2,Y2
Dialog item coordinates, calculated relative to the top left dialog corner (coordinates start from 0,0). For more information about coordinates see the description of a specific dialog item.
Focus
Keyboard focus flag. You must specify one item with Focus equal to TRUE.
Param.Reserved
Size of this members always equals the size of the Param union, which allows to use this member for platform independent initialization.
Param.Selected
Applicable for DI_CHECKBOX and DI_RADIOBUTTON controls. Allows to set their initial state and get their state after closing the dialog.
Param.History
Contains the address of a null-terminated text string that will be used as the internal history name when an edit control has the DIF_HISTORY flag. If several edit controls have the same history name, they will share the same history list.
Param.Mask
Contains the address of a null-terminated string that serves as a mask for a DI_FIXEDIT control.
Param.ListItems
Pointer to a FarList structure that describes the list of items for a DI_COMBOBOX or DI_LISTBOX control.
Param.ListPos
Current list position in a DI_LISTBOX or DI_COMBOBOX control.
Param.VBuf
Pointer to an array of CHAR_INFO structures describing a virtual buffer for the DI_USERCONTROL control.
Flags
Combination of values described in the "Dialog item flags" topic.
DefaultButton
Define current item as the "default control". If while pressing <Enter> the focus is not set on a button, the Dialog function (or DialogEx) will return the number of the item with DefaultButton set to 1. The DefaultButton flag can be set not only for a button, but for any other dialog item.
Data.Data
Buffer to exchange data with the dialog (without DIF_VAREDIT flag). See dialog items descriptions for details.
Data.Ptr.PtrFlags
Additional flags (not used in Dialog API 1.0). Ptr.PtrFlags must be 0.
Data.Ptr.PtrLength
Length of the data pointed to by PtrData.
Data.Ptr.PtrData
Points to the user buffer for the edit data.
Data.Ptr.PtrTail
"Tail" - provides access to the remaining part of the Data member.

Remarks

  1. All information about the FarDialogItem structure is described with named unions taken into account. See details in the _FAR_NO_NAMELESS_UNIONS macro description.
  2. Because the Data.Data member size is large, direct initialization of a FarDialogItem structures array can be very memory consuming. To avoid it, you can, for example, initialize a temporary structure type array with *Data instead of Data[512] and then convert it to a FarDialogItem array using a simple function.
  3. The example function to do the abovementioned conversion can be found in the sources of example plugins supplied with FAR Manager (the InitDialogItems function and the InitDialogItem structure).
  4. The Ptr.* members are used only for DI_EDIT controls with the DIF_VAREDIT flag.
See also: