DI_EDIT

Far Manager

DI_EDIT

The DI_EDIT dialog item describes an edit box.
struct FarDialogItem
{
  int Type             = DI_EDIT
  int X1               = X1
  int Y1               = Y
  int X2               = X2
  int Y2               = Y (equals to Y1)
  int Focus            = Focus
  char *History        = History
  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.

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 fields have the same history name, they will share the same history list.

Flags

There are several flags applicable to the DI_EDIT control:
FlagDescription
DIF_EDITOR Sequential edit controls with this flag are grouped into a simple editor with the ability to insert and delete lines.
DIF_HISTORY Adds a history list to an edit control. If this flag is set, the History field must contain the address of a text string that will be used as the internal name of the history.
DIF_MANUALADDHISTORY Specifies that items will be added to the history list of an edit box only manually, not automatically. Must be used together with DIF_HISTORY.
DIF_USELASTHISTORY The initial value will be set to the last history element.
DIF_EDITEXPAND Expand environment variables.
DIF_DISABLE Disables user access to the edit control.
DIF_READONLY Sets read-only state for the edit control.
DIF_SELECTONENTRY Makes the edit control always select the text when it receives the 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 just before the edit box is drawn.
DN_CTLCOLORDLGITEM The plugin should pass the color attributes of the edit control when this event comes. Param2 parameter:
LoWord LoByte - color of the text
                (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 History drop-down arrow
                (COL_DIALOGTEXT)
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.

See also: