DI_COMBOBOX

Far Manager

DI_COMBOBOX

The DI_COMBOBOX dialog item describes an edit box with a drop-down list (Combo Box).
struct FarDialogItem
{
  int Type             = DI_COMBOBOX
  int X1               = X1
  int Y1               = Y
  int X2               = X2
  int Y2               = Y (equals to Y1)
  int Focus            = Focus
  union {
    FarList *ListItems = ListItems  [passed to]
    int ListPos        = ListPos    [returned]
  };
  DWORD Flags          = Flags
  int DefaultButton    = DefaultButton
  union {
    char Data[512];    = the text for editing (without DIF_VAREDIT)
    struct {
      DWORD PtrFlags;  = advanced flags (not used in Dialog API 1.0)
      int   PtrLength; = size of the user buffer pointed by PtrData
      char *PtrData;   = the pointer to the user buffer
      char  PtrTail[1];= the remainder part of Data
    } Ptr;             = the text for editing (with DIF_VAREDIT)
  };
};

Attention! Attention!

  • This is an exemplary structure; read full description here.

Focus

Keyboard focus flag.

ListItems

This is the pointer to the FarList structure containing fields for the combo box initialization. The "edit" part of the combo box gets the value of the first item in the list with the LIF_SELECTED flag set, if any.

If this field is set to NULL, then the list box will not be shown.

ListPos

Current position in the ListItems.Items list. The index of the item selected by the user is stored in this field after the dialog has been closed.

Flags

There are several flags applicable to the DI_COMBOBOX control (for the flags of the list box, see FarListItem):
FlagDescription
DIF_DROPDOWNLIST Shows non-editable drop-down list instead of a common combo box.
DIF_EDITEXPAND Expand environment variables.
DIF_LISTAUTOHIGHLIGHT Assigns hotkeys for the list elements automatically, starting with the first item.
DIF_LISTNOAMPERSAND Shows a hotkey instead of showing the ampersand itself.
DIF_LISTWRAPMODE If this flag is set, trying to move the cursor up from the first element or down from the last element will move the cursor to the bottom or the top of the list, respectively.
DIF_DISABLE Disables user access to the combo box.
DIF_READONLY Sets read-only state for the edit control.
DIF_SELECTONENTRY Makes the edit control always select the text when it receives focus.
DIF_NOFOCUS The dialog item cannot receive keyboard focus, but can handle other user events.
DIF_VAREDIT If this flag is set, the dialog manager will use only the Ptr.* members instead of Data in the FarDialogItem structure. The use of this flag allows to exceed the 512-byte limit for the edit control.

Events

EventDescription
DN_DRAWDLGITEM This event is sent to the dialog callback function before the combo box is drawn.
DN_CTLCOLORDLGITEM Plugin should pass the color attributes of the edit item of the combo box when this event comes. Param2 parameter:
LoWord LoByte - color of the text in the edit control
                (COL_WARNDIALOGEDIT or
                 COL_DIALOGEDIT)
LoWord HiByte - color of selected text
                (COL_DIALOGEDITSELECTED)
HiWord LoByte - color of unchanged text
                (COL_DIALOGEDITUNCHANGED)
HiWord HiByte - color of the drop-down arrow
                (COL_DIALOGTEXT)
DN_CTLCOLORDLGLIST When this event comes, the plugin may change the color attributes of the list item of the combo box to be drawn.
DN_KEY This event comes after the user has pressed a key in the dialog.
DN_MOUSECLICK This event comes after the user has clicked one of the dialog items or outside the dialog with the mouse button.
DN_EDITCHANGE The text in the edit field has been changed.
DN_KILLFOCUS This event is sent before the combo box loses the focus, if the flag DIF_NOFOCUS was not used.
DN_GOTFOCUS This event is sent after the button has received the keyboard focus, if the flag DIF_NOFOCUS was not used.

Remarks

See also: