# DI_LISTBOX

The DI_LISTBOX dialog item describes a list box.

    struct FarDialogItem
    {
      int Type          = DI_LISTBOX
      int X1            = X1
      int Y1            = Y1
      int X2            = X2
      int Y2            = Y2
      int Focus         = Focus
      union {
        FarList *ListItems= ListItems  [passed to]
        int ListPos       = ListPos    [returned]
      };
      DWORD Flags       = Flags
      int DefaultButton = DefaultButton
      char Data[512];   = Caption
    };

Attention!

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

### ListItems

This is a pointer to the FarList structure containing fields for the list box initialization.

### ListPos

Current position in the ListItems.Items list. The index of the item selected by the user will be stored in this filed when the dialog is closed.

### Flags

There are several flags applicable to the DI_LISTBOX (for the flags of the list box, see FarListItem):

Flag | Description
--- | ---
DIF_LISTAUTOHIGHLIGHT | Assigns hotkeys for the list elements automatically, starting with the first item.
DIF_LISTNOAMPERSAND | Shows a hotkey when a letter is preceded with an ampersand 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 list box.
DIF_NOFOCUS | The dialog item cannot receive keyboard focus, but can handle other user events.
DIF_LISTNOBOX | Disables the drawing of a frame around the list. The Data field is ignored in this case.

### Events

Event | Description
--- | ---
DN_DRAWDLGITEM | This event is sent to the dialog callback function just before the list box is drawn.
DN_CTLCOLORDLGLIST | Plugin should pass the color attributes of the list box when this event comes.
DN_LISTCHANGE | Position in the list was changed.
DN_LISTHOTKEY | This event comes after the user has pressed a hotkey in the list.

See also:
DI_COMBOBOX, FarDialogItem